You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@netbeans.apache.org by Ulrich Mayring <ul...@isys.de> on 2022/02/22 10:30:44 UTC

Netbeans overrides Gradle's own JAVA_HOME

Hi all,

when I run my Spring Boot Gradle 7.2 project from Netbeans 12.6, I am 
getting output like this:

JAVA_HOME="/etc/alternatives/java_sdk_11"
cd /myworkpath/mygradleproject/mysubproject; ../gradlew -x check -x test 
bootRun

The application then runs under JDK 11. This is even though I have in my 
gradle.properties:
org.gradle.java.home=/etc/alternatives/java_sdk_17

And in my build.gradle.kts:
java {
     toolchain {
         languageVersion.set(JavaLanguageVersion.of(17))
     }
}

The /etc/alternatives/java_sdk_11 is the JDK I have set in netbeans.conf 
for Netbeans to run the IDE under.

When I run ../gradlew -x check -x test bootRun from the command line, 
the application starts with Java 17 as defined in gradle.properties.

It appears that Netbeans sets its own JDK definition as JAVA_HOME for 
every build. Does anyone know how to prevent this override?

Kind regards,

Ulrich


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

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


Re: Netbeans overrides Gradle's own JAVA_HOME

Posted by Ulrich Mayring <ul...@isys.de>.
Am 22.02.22 um 11:43 schrieb Neil C Smith:
> On Tue, 22 Feb 2022 at 10:35, Ulrich Mayring <ul...@isys.de> wrote:
>> It appears that Netbeans sets its own JDK definition as JAVA_HOME for
>> every build. Does anyone know how to prevent this override?
> 
> Use Tools / Java Platforms and register the right JDK.
> 
> Set this as the JDK to use in the project properties (under Build / Compile)
> 
> That should work for you with this configuration I think?

You are of course right. It used to be that I couldn't change the 
platform under Build / Compile (the option was greyed out) for an 
earlier version of the gradle plugin. So I didn't remember that this 
option even exists. Now it seems to work as expected.

Thanks, Ulrich


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

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


Re: Netbeans overrides Gradle's own JAVA_HOME

Posted by Neil C Smith <ne...@apache.org>.
On Tue, 22 Feb 2022 at 10:35, Ulrich Mayring <ul...@isys.de> wrote:
> It appears that Netbeans sets its own JDK definition as JAVA_HOME for
> every build. Does anyone know how to prevent this override?

Use Tools / Java Platforms and register the right JDK.

Set this as the JDK to use in the project properties (under Build / Compile)

That should work for you with this configuration I think?

Neil

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

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