The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
August 2001

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

Escape char?

Posted by hotboy on August 18, 2001 at 12:12 PM

> Hi I'm trying to execute a jar file from another java program. But for some reason this doesnt work.
> try{
> Runtime.getRuntime().exec(
> "c:/pathname/java.exe -jar MyPgm.jar");
> }
> catch(IOException ioe){ioe.printStackTrace();}

> the above code just opens a dos window and quickly closes it.
> When i try executing that string in windows run it works but for some reason out of my java program it doesnt. Anyone know why??
> thanx

Did you use escape charactor for your "/",
The path in your case should be "c://pathname//java -jar MyPgm.jar",

Let me know if that solve the problem.




Replies:
  • re: Oliver November 28, 2001 at 5:01 AM (0)

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us