问题
Suppose we have two java applications A and B. Application A will call application B. Application A has started, however when A calls B, I don't know the java_home or any other jre path, I want to get which jre application A is run on, return the jre's execution file's path, is this possible?
回答1:
You can get the installation directory for the JRE by requesting the system propertie java.home
:
String jrePath = System.getProperty("java.home");
More on System Properties here.
来源:https://stackoverflow.com/questions/7176603/get-current-jres-file-path