JAL-3130 call Jalview via the Test JVM’s JAVA_HOME/bin/java
[jalview.git] / test / jalview / bin / CommandLineOperations.java
index cb08563..6454899 100644 (file)
@@ -129,6 +129,8 @@ public class CommandLineOperations
 
   private static String modules = null;
 
+  private static String java_exe = null;
+
   public synchronized static String getClassPath()
   {
     if (scanner == null)
@@ -141,6 +143,9 @@ public class CommandLineOperations
       {
         modules.concat(mr.getName());
       }
+      java_exe = System.getProperty("java.home") + File.separator + "bin"
+              + File.separator + "java";
+
     }
     while (classpath == null)
     {
@@ -161,7 +166,8 @@ public class CommandLineOperations
     // Note: JAL-3065 - don't include quotes for lib/* because the arguments are
     // not expanded by the shell
     String classpath = getClassPath();
-    String _cmd = "java " + (withAwt ? "-Djava.awt.headless=true" : "")
+    String _cmd = java_exe + " "
+            + (withAwt ? "-Djava.awt.headless=true" : "")
             + " -classpath " + classpath
             + (modules.length() > 2 ? "--add-modules=\"" + modules + "\""
                     : "")