Problem while Invoke Shell Script function from Java Program

Hi,

I have create a Shell Script, with one function.

I want to call the script file in Java Program.

It working fine. but the problem is the function in the Shell Script is not executed.

Please suggest me,

Regards,
Nanthagopal A

Have you called that function in your shell script?

yes. i have called that function. while running in Konsole i got the output. But when invoke through Java Program. Only function not get executed. other things are working.

 #!/bin/bash

echo "Test shell script"

function checkfunction() 
{
  echo "hey!  shell script function called"
}

checkfunction

when i execute the above program in local/terminal. i got the output:
Test shell script
hey! shell script function called

NOTE:
When i invoke the above shell script from java using the code

Runtime.getRuntime().exec(filename.sh) ;

i got the output:
Test shell script

Here the problem is, the function in shell script is not invoked.

whether i have to export the functions?
Please Suggest me, how to solve this problem.

Regards,
Nanthagopal A

Thank You