Better method for searching JAVA
[jabaws.git] / engine / compbio / engine / client / Util.java
index 66f3a35..634112f 100644 (file)
@@ -253,6 +253,7 @@ public final class Util {
                } else {\r
                        bin = ph.getProperty("cluster." + execCommandName + ".bin");\r
                }\r
+               log.debug("Using executable: " + bin);\r
                return bin; // File.separator\r
        }\r
        /**\r
@@ -274,7 +275,15 @@ public final class Util {
         * @return\r
         */\r
        public static String getJava() {\r
-               String javahome = System.getenv("JAVA_HOME");\r
+               String javahome = System.getProperty("java.home");\r
+               if (compbio.util.Util.isEmpty(javahome)) {\r
+                       javahome = System.getenv("JAVA_HOME");\r
+               }\r
+               if (compbio.util.Util.isEmpty(javahome)) {\r
+                       log.warn("Cannot find Java in java.home system property "\r
+                                       + "or JAVA_HOME environment variable! ");\r
+                       return null;\r
+               }\r
                File jh = new File(javahome);\r
                if (jh.exists() && jh.isDirectory()) {\r
                        String java = javahome + File.separator + "bin" + File.separator\r