Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   Automate program execution problem (Runtime.exec("java" + " Hello.java"); (http://www.velocityreviews.com/forums/t149616-automate-program-execution-problem-runtime-exec-java-hello-java.html)

seenuvas 01-24-2006 12:54 PM

Automate program execution problem (Runtime.exec("java" + " Hello.java");
 
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 01-24-2006 12:58 PM

Re: Automate program execution problem (Runtime.exec("java" + " Hello.java");
 
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 01-24-2006 01:03 PM

Re: Automate program execution problem (Runtime.exec("java" + " Hello.java");
 
There is no error in the program

By
Seenu


Jeffrey Schwab 01-24-2006 01:04 PM

Re: Automate program execution problem (Runtime.exec("java" + " Hello.java");
 
seenuvas wrote:
> 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 01-24-2006 01:12 PM

Re: Automate program execution problem (Runtime.exec("java" + " Hello.java");
 
sorry

It is Runtime.exec("java" + " Hello");

There is one space before Hello


opalpa@gmail.com opalinski from opalpaweb 01-24-2006 01:37 PM

Re: Automate program execution problem (Runtime.exec("java" + " Hello.java");
 
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/


Francesco Devittori 01-24-2006 02:36 PM

Re: Automate program execution problem (Runtime.exec("java" + " Hello.java");
 
seenuvas wrote:
> 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 01-24-2006 07:04 PM

Re: Automate program execution problem (Runtime.exec("java" + " Hello.java");
 
On 24 Jan 2006 04:54:55 -0800, "seenuvas" <seenuonnet@rediffmail.com>
wrote, quoted or indirectly quoted someone who said :

>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
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.


All times are GMT. The time now is 01:16 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.