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:

Method getRuntime().exec

Posted by Alex Friedman on August 16, 2001 at 1:12 AM

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



Replies:
  • exec call Erich Teppan October 22, 2001 at 8:47 AM (1)
    • exec call Matt Gerrans October 22, 2001 at 5:47 PM (0)
  • exec call Erich Teppan October 22, 2001 at 8:44 AM (0)
  • Escape char? hotboy August 18, 2001 at 12:12 PM (1)
    • 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