Perhaps best way to deal with this is to use the Gradle feature to set the tool 
chain version. In your build.gradle file do this:

java {
    toolchain {
        languageVersion = JavaLanguageVersion.of(17)
    }
}

See: https://docs.gradle.org/current/userguide/toolchains.html#header

Scott

> On Sep 10, 2022, at 11:47 AM, Ernie Rael <err...@raelity.com> wrote:
> 
> Thanks Davide, but I wasn't clear about what's going on.
> 
> Let's say I run NetBeans with jdk-17. I have some gradle projects that 
> require jdk-11.
> 
> So, while running NetBeans with jdk-17, I'd like to work on the gradle 
> projects that require jdk-11.
> 
> I set the gradle project's
> 
>   ProjectProperties > Build > Compile > JavaPlatform: JDK 11
> 
> but that doesn't appear to do anything useful. In addition, I don't see where 
> this property is getting saved; there's no project.properties file, and VCS 
> didn't show any changes.
> 
> NetBeans says it tries to understand the gradle build for getting 
> information. When I do a CleanAndBuild there are errors, although jdk-11 is 
> set for the project.
> 
> -ernie
> 
>> On 9/9/22 11:54 PM, Davide Grandi wrote:
>> I run nb with
>> 
>> SETLOCAL
>> SET JAVA_HOME=...
>> START C:\sviluppo\programs\netbeans\14\bin\netbeans64.exe^
>>  --jdkhome "%JAVA_HOME%"^
>>  --userdir  "C:\sviluppo\user.home\netbeans\14\userdir"^
>>  --cachedir "C:\sviluppo\user.home\netbeans\14\cachedir"^
>>  --console suppress^
>>  -J-Duser.home=C:\sviluppo\user.home^
>>  -J-Xms4096m^
>>  -J-Xmx4096m
>> 
>> (because I've multiple jdk but none of them _installed_, all uncompressed)
>> 
>> But there's also a (commented) variable on nb folder :
>>     ./etc/netbeans.conf
>> -- 
>> # Default location of JDK:
>> # (set by installer or commented out if launcher should decide)
>> #
>> # It can be overridden on command line by using --jdkhome <dir>
>> # Be careful when changing jdkhome.
>> # There are two NetBeans launchers for Windows (32-bit and 64-bit) and
>> # installer points to one of those in the NetBeans application shortcut
>> # based on the Java version selected at installation time.
>> #
>> #netbeans_jdkhome="/path/to/jdk"
>> -- 
>> 
>> bye,
>> 
>>     Davide
>> 
>>> On 10/09/2022 02:42, Ernie Rael wrote:
>>> I must run NB with jdk-11 (or jdk-15 but not the latest LTS).
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@netbeans.apache.org
> For additional commands, e-mail: users-h...@netbeans.apache.org
> 
> For further information about the NetBeans mailing lists, visit:
> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
> 

Reply via email to