Tuesday, 17 September 2013

Calling a simple shell script from java is not working

Calling a simple shell script from java is not working

My Shell script named "hello"
#This is a shell script
echo "Hello Shell World!"
My Java Code,
Runtime.getRuntime().exec(new String[]{"./hello"});
My Java code is executed with no errors, but I do not see "Hello Shell
World!" being printed on the terminal.
I believe my script is being executed since I do not get errors like,
"hello cannot be executed, there is no such file or directory".
I am executing this on a Linux machine, Ubuntu. Thanks!

No comments:

Post a Comment