aspose file tools*
The moose likes Beginning Java and the fly likes Help with Runtime.exec() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Help with Runtime.exec()" Watch "Help with Runtime.exec()" New topic
Author

Help with Runtime.exec()

Jennifer Sohl
Ranch Hand

Joined: Feb 28, 2001
Posts: 455
Hello. I am launching a java app from within another java app.
Here is the code I am using to launch to app:

When this runs, it brings up the app OK.
Now, when I add the lines of code to set the parameters in the main
method of the app being launched and try to run it, nothing happens.
Here is the main method of the app being launched:

What am I doing wrong?
Thanks!
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919



Groovy
Jennifer Sohl
Ranch Hand

Joined: Feb 28, 2001
Posts: 455
I tried your suggestion (Here's my code):

and still nothing is coming up. Any other ideas?
Thanks!
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

Looks like there is some error
Add this

If it prints 0 => the process runs fine
non-zero=>There is a error
[ September 23, 2003: Message edited by: Pradeep Bhat ]
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

I tried running a simliar program and it worked fine.
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Jennifer,
I'm not sure that you'll be able to come up with a platform independent use of Runtime.getRuntime.exec() to run another Java application. I've read from more than one resource that its use is not recommended.
(I'm not sure that the following "solution" is necessarily a good idea, but you might want to try it out.) Perhaps invoking the main method just as if it were any ol' method will do the trick.
[ October 02, 2003: Message edited by: Dirk Schreckmann ]

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
 
jQuery in Action, 2nd edition
 
subject: Help with Runtime.exec()