0

Was reading this question: Execute .jar file from a Java program and the answer tells you to use a ProcessBuilder:

ProcessBuilder pb = new ProcessBuilder("/path/to/java", "-jar", "your.jar");

How do I find out the /path/to/java using code? Of course I could look up java in my machine, but an end-user may not necessarily have Java installed in the same place as I do...

Community
  • 1
  • 1
Saturn
  • 17,888
  • 49
  • 145
  • 271
  • http://stackoverflow.com/questions/6493856/how-to-programatically-get-all-java-jvm-installed-not-default-one-using-java – Nielarshi Mar 07 '15 at 20:17

1 Answers1

1

Use System.getProperty("java.home").

yole
  • 92,896
  • 20
  • 260
  • 197