diff --git a/bindings/java/hyperic_jni/jni-build.xml b/bindings/java/hyperic_jni/jni-build.xml index 3601e133..3dbb548c 100644 --- a/bindings/java/hyperic_jni/jni-build.xml +++ b/bindings/java/hyperic_jni/jni-build.xml @@ -54,15 +54,6 @@ USA. - - - - - - - java.home=${jni.javahome} - - @@ -180,6 +171,10 @@ USA. + java.home=${jni.javahome} + + + diff --git a/bindings/java/hyperic_jni/src/org/hyperic/jni/ArchNameTask.java b/bindings/java/hyperic_jni/src/org/hyperic/jni/ArchNameTask.java index 5a991b99..46bf2976 100644 --- a/bindings/java/hyperic_jni/src/org/hyperic/jni/ArchNameTask.java +++ b/bindings/java/hyperic_jni/src/org/hyperic/jni/ArchNameTask.java @@ -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