I want to automate the program compilation and execution.
I used Runtime.exec("javac" +" Hello.java"); for compilation the
program compiled successfully.
in the next liine i gave Runtime.exec("java" + "Hello"); This statement
dosen't performs execution.
Anybody knows tell me the solution for this problem
By
Seenu
opalpa@gmail.com opalinski from opalpaweb - 24 Jan 2006 12:58 GMT
Maybe something simple like Hello's byte code is not within searched
directories of invoked java executable.
What's the error? Where is your code?
Opalinski
opalpa@gmail.com
http://www.geocities.com/opalpaweb/
seenuvas - 24 Jan 2006 13:03 GMT
There is no error in the program
By
Seenu
opalpa@gmail.com opalinski from opalpaweb - 24 Jan 2006 13:37 GMT
Want to bet?
Your refusal to post code is ... weird.
My specific guess diagnosis is A) you're not directing output from
subprocess and so you don't see an error B) the error probably talks
about class not being found.
---
Using java.exe from withing a jvm is questionable.
---
How about wrapping up "java Hello" in a script that runs with an empty
environment? Then invoke the script with Runtime.exec . If you're
trying to do something professional handle sub processes streams, man.
---
Opalinski
opalpa@gmail.com
http://www.geocities.com/opalpaweb/
Jeffrey Schwab - 24 Jan 2006 13:04 GMT
> I want to automate the program compilation and execution.
>
> I used Runtime.exec("javac" +" Hello.java"); for compilation the
> program compiled successfully.
> in the next liine i gave Runtime.exec("java" + "Hello"); This statement
You're missing a space. Do you have a program called javaHello?
> dosen't performs execution.
>
> Anybody knows tell me the solution for this problem
>
> By
> Seenu
seenuvas - 24 Jan 2006 13:12 GMT
sorry
It is Runtime.exec("java" + " Hello");
There is one space before Hello
Francesco Devittori - 24 Jan 2006 14:36 GMT
> sorry
>
> It is Runtime.exec("java" + " Hello");
>
> There is one space before Hello
maybe the java executable is not found? Try with the full path
(/opt/jdk/bin/java or C:\whatever)
Roedy Green - 24 Jan 2006 19:04 GMT
>I used Runtime.exec("javac" +" Hello.java"); for compilation the
>program compiled successfully.
>in the next liine i gave Runtime.exec("java" + "Hello"); This statement
>dosen't performs execution.
see http://mindprod.com/javacexe.html#MAIN for a more efficient way of
invoking the Javac compiler.
you tried to exec "javaHello" which does not exist. You meant
something like this:
"java.exe Hello"
exec wants specific extensions. If you don't have them, you need to
spawn a command processor that will guess them.
see http://mindprod.com/jgloss/exec.html

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.