Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / January 2006

Tip: Looking for answers? Try searching our database.

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

Thread view: 
seenuvas - 24 Jan 2006 12:54 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
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.



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.