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...

1

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.