You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by lk...@apache.org on 2020/09/07 21:24:49 UTC

[netbeans] branch master updated: [NETBEANS-4722] Add JAVA_HOME to Gradle build environment variables

This is an automated email from the ASF dual-hosted git repository.

lkishalmi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git


The following commit(s) were added to refs/heads/master by this push:
     new 2248d24  [NETBEANS-4722] Add JAVA_HOME to Gradle build environment variables
2248d24 is described below

commit 2248d24284197b0f44098b33f6d7276e79798ac7
Author: Laszlo Kishalmi <la...@gmail.com>
AuthorDate: Tue Aug 18 23:33:53 2020 -0700

    [NETBEANS-4722] Add JAVA_HOME to Gradle build environment variables
---
 .../org/netbeans/modules/gradle/execute/GradleDaemonExecutor.java  | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/extide/gradle/src/org/netbeans/modules/gradle/execute/GradleDaemonExecutor.java b/extide/gradle/src/org/netbeans/modules/gradle/execute/GradleDaemonExecutor.java
index 48aff32..ec48fae 100644
--- a/extide/gradle/src/org/netbeans/modules/gradle/execute/GradleDaemonExecutor.java
+++ b/extide/gradle/src/org/netbeans/modules/gradle/execute/GradleDaemonExecutor.java
@@ -35,6 +35,8 @@ import java.io.OutputStream;
 import java.io.StreamCorruptedException;
 import java.nio.file.Path;
 import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 import javax.swing.AbstractAction;
@@ -151,7 +153,10 @@ public final class GradleDaemonExecutor extends AbstractGradleExecutor {
             if (platformProvider != null) {
                 try {
                     buildLauncher.setJavaHome(platformProvider.getJavaHome());
-                } catch (FileNotFoundException ex) {
+                    Map<String, String> envs = new HashMap<>(System.getenv());
+                    envs.put("JAVA_HOME", platformProvider.getJavaHome().getCanonicalPath());
+                    buildLauncher.setEnvironmentVariables(envs);
+                } catch (IOException ex) {
                     io.getErr().println(Bundle.NO_PLATFORM(ex.getMessage()));
                     return;
                 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists