(SIGAR-214) properly adjust jni.javahome when JAVA_HOME is not set

This commit is contained in:
Doug MacEachern committed 2010-04-09 09:01:13 -07:00
1 parent 9ce6361973
commit 4227bf6ab9
2 files changed
+15 -9

No files matched your search

@@ -138,6 +138,17 @@ public class ArchNameTask extends Task {
}
}
getProject().setProperty("jni.scmrev", getSourceRevision());
//jni.javahome required to find include/jni.h
String home = getProject().getProperty("jni.javahome");
if (home == null) {
home = System.getProperty("java.home");
}
File dir = new File(home);
if (!new File(dir, "include").exists()) {
dir = dir.getParentFile(); //was /jre
}
getProject().setProperty("jni.javahome", dir.getPath());
}
//XXX source rev stuff should be in another task