Author: rombert
Date: Fri Sep 15 11:56:13 2017
New Revision: 1808449

URL: http://svn.apache.org/viewvc?rev=1808449&view=rev
Log:
SLING-7128 - slingstart-maven-plugin should respect JAVA_HOME when set

Add support for JAVA_HOME in the LauncherCallable

Modified:
    
sling/trunk/tooling/maven/slingstart-maven-plugin/src/main/java/org/apache/sling/maven/slingstart/run/LauncherCallable.java

Modified: 
sling/trunk/tooling/maven/slingstart-maven-plugin/src/main/java/org/apache/sling/maven/slingstart/run/LauncherCallable.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/tooling/maven/slingstart-maven-plugin/src/main/java/org/apache/sling/maven/slingstart/run/LauncherCallable.java?rev=1808449&r1=1808448&r2=1808449&view=diff
==============================================================================
--- 
sling/trunk/tooling/maven/slingstart-maven-plugin/src/main/java/org/apache/sling/maven/slingstart/run/LauncherCallable.java
 (original)
+++ 
sling/trunk/tooling/maven/slingstart-maven-plugin/src/main/java/org/apache/sling/maven/slingstart/run/LauncherCallable.java
 Fri Sep 15 11:56:13 2017
@@ -26,6 +26,7 @@ import java.io.LineNumberReader;
 import java.lang.ProcessBuilder.Redirect;
 import java.net.InetSocketAddress;
 import java.net.Socket;
+import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.Callable;
@@ -141,7 +142,10 @@ public class LauncherCallable implements
         final ProcessBuilder builder = new ProcessBuilder();
         final List<String> args = new ArrayList<String>();
 
-        args.add("java");
+        String javaHome = System.getenv("JAVA_HOME");
+        String javaCmd = javaHome != null ? Paths.get(javaHome, "bin", 
"java").toString() : "java";
+
+        args.add(javaCmd);
         add(args, this.configuration.getVmOpts());
         add(args, 
this.configuration.getVmDebugOpts(this.environment.getDebug()));
 


Reply via email to