Uploaded image for project: 'NetBeans'
  1. NetBeans
  2. NETBEANS-4722

JAVA_HOME not set on Gradle projects.

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 12.0
    • Fix Version/s: 12.2
    • Component/s: projects - Gradle
    • Labels:
    • Environment:
      MacOS X 10.15.6, Apache NetBeans IDE 12.0, Gradle plugin 1.4

      Description

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

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

      the result in the Output window is:

      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
      

      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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                lkishalmi Laszlo Kishalmi
                Reporter:
                jpereda José Pereda
              • Votes:
                1 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m