File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help with Runtime.exec()

 
Jennifer Sohl
Ranch Hand
Posts: 455
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8927
Firefox Browser Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Jennifer Sohl
Ranch Hand
Posts: 455
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried your suggestion (Here's my code):

and still nothing is coming up. Any other ideas?
Thanks!
 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8927
Firefox Browser Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried running a simliar program and it worked fine.
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic