José Pereda created NETBEANS-4722:
-------------------------------------

             Summary: JAVA_HOME not set on Gradle projects (MacOS only)
                 Key: NETBEANS-4722
                 URL: https://issues.apache.org/jira/browse/NETBEANS-4722
             Project: NetBeans
          Issue Type: Bug
    Affects Versions: 12.0
         Environment: MacOS X 10.15.6, Apache NetBeans IDE 12.0, Gradle plugin 
1.4
            Reporter: José Pereda


On a new empty "Java with Gradle" project, when running with `run`:

{code:java}
public static void main(String[] args) {
    System.out.println("ENV1: " + System.getenv("JAVA_HOME"));
    System.out.println("ENV2: " + System.getenv("_"));
}
{code}

the result in the Output window is:

{code:java}
JAVA_HOME="/Users/$user/Downloads/jdk-11.0.2.jdk/Contents/Home"
cd /Users/$user/NetBeansProjects/gradleproject; ./gradlew --configure-on-demand 
-x check run
Configuration on demand is an incubating feature.
> Task :compileJava
> Task :processResources NO-SOURCE
> Task :classes

> Task :run
ENV1: null
ENV2: /Users/$user/Downloads/jdk-11.0.2.jdk/Contents/Home/bin/java
{code}

So internally JAVA_HOME is set for NetBeans, but the project doesn't have 
access to it.

This might be a bug, as there is an environment variable named `_` that has the 
value expected for `JAVA_HOME`.

On a Maven project, `JAVA_HOME` is printed with the correct value, but `_` 
doesn't exist (as expected). This result is the also the expected for both 
Maven and Gradle projects on Windows.




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

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

Reply via email to