The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.

Implementing restartApplication method in Java

I attempted to implement my own version of a restartApplication method I found on the internet. All I added was the location of my javabin and the location of a jar file for it to relaunch. I also made the method static so I don't have to create an object to call it.

When I run my program, it runs fine up until the point it is supposed to restart. Instead of restarting, I get this error:

java.io.IOException: Cannot run program "null\bin\java": CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(ProcessBuilder.java :1029)
at TreeChartUI.restartApplication(TreeChartUI.java:54 3)
at TreeChartUI.main(TreeChartUI.java:596)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(ProcessImpl.java:189)
at java.lang.ProcessImpl.start(ProcessImpl.java:133)
at java.lang.ProcessBuilder.start(ProcessBuilder.java :1021)
... 2 more