aspose file tools*
The moose likes Java in General and the fly likes on process exec (String[] cmdarray) 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 » Java in General
Bookmark "on process exec (String[] cmdarray)" Watch "on process exec (String[] cmdarray)" New topic
Author

on process exec (String[] cmdarray)

christine clarin
Ranch Hand

Joined: Feb 05, 2005
Posts: 106
how do i use this method? for example i have an exe file visual.exe which needs 3 arguments:

visual -din arg1 -cout arg2 -dout arg3

how do i run this from a java program? i tried doing this:

Runtime rt = Runtime.getRuntime ();
Process p1 = rt.exec ("visual -din" + arg1 "-cout" + arg2 + "-dout" + arg3);
p1.waitFor ();

but it does not work, it only works if i fix the arguments:

Runtime rt = Runtime.getRuntime ();
Process p1 = rt.exec ("visual -din arg1 -cout arg2 -dout arg3");
p1.waitFor ();

but i need to run this program such that i can change the arguments, how do i do this. Note: I don't change the arguments from standard input, i just change the arguments within the program. Thank you.
David Harkness
Ranch Hand

Joined: Aug 07, 2003
Posts: 1646
As Ernest pointed out in your other thread (we generally try not to cross post the same question to multiple threads), you need spaces between "-din" and the argument. Your build command looks like this:The form of exec that takes a String array could be used by your code like this:
[ February 06, 2005: Message edited by: David Harkness ]
christine clarin
Ranch Hand

Joined: Feb 05, 2005
Posts: 106
thanks. sorry for the multiple thread. till next time.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: on process exec (String[] cmdarray)