I am writing a program that updates it's self. I get all the updating working, I just need the program to restart it's self. Here is my current code:
String javaPath = System.getProperty("java.home");
Process process = new ProcessBuilder(javaPath, "-jar", ClientPortal.class.getProtectionDomain().getCodeSource().getLocation().getPath()).start();
I get an error though:
java.io.IOException: Cannot run program "/usr/lib/jvm/java-8-oracle/jre": error=13, Permission denied
I tried running this in my own console, and it is denied. The reason I am using the path of Java instead of just using the command java
, is because, like me, people might have multiple Java instances installed and the wrong one is run. The command might simply be not available.
How can I run the same JVM in this fashion?