How can I find a JVM ( java command, e.g. /usr/bin/java for mac and C:\Program Files\Java\bin\java.exe for Windows) from a Java application?
Reason: I am running an JNLP application that should download and launch other jar. I cannot just load the other jar because it has native libraries which could not be launched as JNLP.
You could figure this out by using the java.home system property, which returns the path to the currently running jvm.
System.getProperty("java.home");
To be truly platform independent, you'd need to combine this with some platform detection to decide whether to append "bin/java" or "bin\java.exe", but it should be reasonably straightforward to do using some of the other system properties.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With