I get this error,
Exception in thread "main" java.io.IOException: Cannot run program "java -jar C:\Users\Jack\testFile.jar\" (in directory "\"): CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(Unknown Source)
at testProject.Main.main(Main.java:15)
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>(Unknown Source)
at java.lang.ProcessImpl.start(Unknown Source)
... 2 more
when trying to use this code:
ProcessBuilder pbT = new ProcessBuilder("java -jar "+files[0]);;
pbT.directory(new File("/"));
pbT.start();
That's just in my main()
method
Does anyone have any insight as to why, and if so how I can fix it?
Thanks!
-Jack