Results 1 to 2 of 2
- 08-10-2012, 12:03 AM #1
Senior Member
- Join Date
- Jul 2010
- Posts
- 125
- Rep Power
- 0
Process via ProcessBuilder isn't running
When I run this, nothing happens. What could be the problem? I'm trying to run a JAR file with VM parametersJava Code:@Override public void run() { File file = new File("./MyJar.jar"); ProcessBuilder pb = null; try { System.out.println(file.getCanonicalPath()); pb = new ProcessBuilder("java", " -Djava.net.preferIPv4Stack=true -Xbootclasspath/p:" + file.getCanonicalPath()+ "-jar", file.getCanonicalPath()); pb.directory(new File("./")); } catch (IOException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } //pb.directory(new File("./")); BufferedReader stdInput = null; try { Process proc = pb.start(); System.out.println("program started started"); proc.waitFor(); } catch (IOException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } catch (InterruptedException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } }
- 08-10-2012, 01:41 AM #2
Moderator
- Join Date
- Jul 2010
- Location
- California
- Posts
- 1,619
- Rep Power
- 5
Re: Process via ProcessBuilder isn't running
Get the output and error Stream from the process, and read them
See When Runtime.exec() won't - JavaWorld
Similar Threads
-
processBuilder
By Lund01 in forum New To JavaReplies: 3Last Post: 10-11-2011, 01:07 PM -
Using ProcessBuilder
By efebatistaarda in forum Advanced JavaReplies: 4Last Post: 02-11-2011, 08:40 PM -
Process running or not
By smartsubroto in forum New To JavaReplies: 4Last Post: 11-16-2009, 03:09 AM -
Controlling the running os process
By Muralidharan in forum Threads and SynchronizationReplies: 1Last Post: 03-26-2009, 07:03 AM -
Process still running
By gatzke in forum New To JavaReplies: 12Last Post: 01-29-2009, 01:00 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks