• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Process and Runtime Class

 
Siva Masilamani
Ranch Hand
Posts: 385
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I was just studying about Process and Runtime class and tried few example and got struck with the below problem.

I am trying to call another java program using differnt JDK by apssing argument.

But the problem is when the argument contain spaces i put them inside the " but still it consider them as two arguments.

Please help.



After running this code the length of argument is 2 instead of 1.

When i display the passed arguments in another class,it is showing as two arguments namely "Test and Sample" instead of Test Sample.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you try to use java.lang.Runtime#exec(java.lang.String[]) instead ?
 
Siva Masilamani
Ranch Hand
Posts: 385
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yep

That helped me.
Thanks a lot
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Make sure to read the article by Michael Daconta called "when Runtime.exec() won't" before using Runtime.exec().
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic