Getting java home isn't that hard if you're running java code

This commit is contained in:
Maxim Shafirov
2011-12-29 21:18:03 +04:00
parent c6caffe02d
commit a03b486101
@@ -97,6 +97,13 @@ public class CompileEnvironment {
public static File findRtJar(boolean failOnError) {
String javaHome = System.getenv("JAVA_HOME");
if (javaHome == null) {
javaHome = System.getProperty("java.home");
if ("jre".equals(new File(javaHome).getName())) {
javaHome = new File(javaHome).getParent();
}
}
File rtJar;
if (javaHome == null) {
rtJar = findActiveRtJar(failOnError);