Topics

JDK version issue in NetBeans

Andrew Crosland
 

Coming back to looking at the source after a few months, at the very start of a clean build I see a warning:
 
"ant -f D:\\JMRI\\nbproject\\nbjdk.xml clean debug
Warning: nbjdk.active=JDK_1.8 or nbjdk.home=${platforms.JDK_1.8.home} is an invalid Java platform; ignoring and using C:\Program Files\Java\jdk1.8.0_25"
 
There was a change on 20th June (more recent than my last use), to use JDK 1.8 in NetBeans if present.
 
The project seems to build OK, at the end of the process I see this warning, which I am guessing is related:
 
"warning: Supported source version 'RELEASE_7' from annotation processor 'org.netbeans.modules.openide.util.ServiceProviderProcessor' less than -source '1.8'"
 
In the IDE, tools > Java Platforms shows I am using JDK 1.8 from the C:\Program Files\... location
 
I don't want to edit the nbproject files to change nbjdk.active or set nbjdk.home (not currently set) in case I check them in and break someone else's build. I am guessing a path or environment variable is missing.
 
Can someone point me in the right direction to clean up the warnings?
 
--
Andrew Crosland

Randall Wood
 

The second warning (“Supported source version 'RELEASE_7'...”) is unrelated to the first and must be ignored. It’s an artifact of a dependency using a strange feature of Java that turns out to be not so great.

As to the first warning, you should be able to set the JDK in NetBeans (I’m not by a computer right now, but I think it’s under the project properties). If you set the name of the JDK you are using to “JDK_1.8” that first warning will be ignored (it’s quite possible that the name is only the default name for a 1.8 JDK in the specific circumstances that I added a 1.8 JDK to the copy NetBeans when I made that change.

Randall

On Oct 16, 2019, at 14:58, Andrew Crosland <andrew@...> wrote:


Coming back to looking at the source after a few months, at the very start of a clean build I see a warning:
 
"ant -f D:\\JMRI\\nbproject\\nbjdk.xml clean debug
Warning: nbjdk.active=JDK_1.8 or nbjdk.home=${platforms.JDK_1.8.home} is an invalid Java platform; ignoring and using C:\Program Files\Java\jdk1.8.0_25"
 
There was a change on 20th June (more recent than my last use), to use JDK 1.8 in NetBeans if present.
 
The project seems to build OK, at the end of the process I see this warning, which I am guessing is related:
 
"warning: Supported source version 'RELEASE_7' from annotation processor 'org.netbeans.modules.openide.util.ServiceProviderProcessor' less than -source '1.8'"
 
In the IDE, tools > Java Platforms shows I am using JDK 1.8 from the C:\Program Files\... location
 
I don't want to edit the nbproject files to change nbjdk.active or set nbjdk.home (not currently set) in case I check them in and break someone else's build. I am guessing a path or environment variable is missing.
 
Can someone point me in the right direction to clean up the warnings?
 
--
Andrew Crosland

Svata Dedic
 

Dne 16. 10. 19 v 20:58 Andrew Crosland napsal(a):
start of a clean build I see a warning:
"ant -f D:\\JMRI\\nbproject\\nbjdk.xml clean debug
Warning: nbjdk.active=JDK_1.8 or nbjdk.home=${platforms.JDK_1.8.home} is an invalid Java platform; ignoring and using C:\Program
Your project is set up to look for Java Platform named "JDK 1.8" (the space is replaced by underscore for setting persistence). The default JDK used to run NetBeans IDE may be present, but has a different (builtin, fixed) name, so it does not count.

Add any JDK8 with that name (Tools > Java Platforms) to your NetBeans IDE.

The way how the project is set up today does not allow to override versioned
nbproject/nbjdk.properties
with your private defaults; the versioned property file is loaded first, the (local) user build properties later. Ant only honours first definition of the property.

The project seems to build OK, at the end of the process I see this warning, which I am guessing is related:
"warning: Supported source version 'RELEASE_7' from annotation processor 'org.netbeans.modules.openide.util.ServiceProviderProcessor' less than -source '1.8'"
You can't do anything about it in JMRI, but it can be done in Apache NetBeans project (JMRI uses org.openide.lookup library). The annotation processor could (finally !!) declare RELEASE_8, as NetBeans already supports just JDK8+ for compilation.

-Svata

Svata Dedic
 

Dne 16. 10. 19 v 20:58 Andrew Crosland napsal(a):
"warning: Supported source version 'RELEASE_7' from annotation processor 'org.netbeans.modules.openide.util.ServiceProviderProcessor' less than -source '1.8'"
Did the world a little better: https://github.com/apache/netbeans/pull/1578

JMRI needs to wait for release 11.3 it's not critical to push it to upcoming 11.2.

-Svata

Andrew Crosland
 

Thanks. I think the problem was that the JDK was "JDK 1.8 (Default)". Adding "JDK 1.8" removes the warning.

Andrew

------ Original Message ------
From: "Svata Dedic" <svatopluk.dedic@...>
To: jmri@jmri-developers.groups.io
Sent: 16/10/2019 22:29:01
Subject: Re: [jmri-developers] JDK version issue in NetBeans

Dne 16. 10. 19 v 20:58 Andrew Crosland napsal(a):
start of a clean build I see a warning:
"ant -f D:\\JMRI\\nbproject\\nbjdk.xml clean debug
Warning: nbjdk.active=JDK_1.8 or nbjdk.home=${platforms.JDK_1.8.home} is an invalid Java platform; ignoring and using C:\Program
Your project is set up to look for Java Platform named "JDK 1.8" (the space is replaced by underscore for setting persistence). The default JDK used to run NetBeans IDE may be present, but has a different (builtin, fixed) name, so it does not count.

Add any JDK8 with that name (Tools > Java Platforms) to your NetBeans IDE.

The way how the project is set up today does not allow to override versioned
nbproject/nbjdk.properties
with your private defaults; the versioned property file is loaded first, the (local) user build properties later. Ant only honours first definition of the property.

The project seems to build OK, at the end of the process I see this warning, which I am guessing is related:
"warning: Supported source version 'RELEASE_7' from annotation processor 'org.netbeans.modules.openide.util.ServiceProviderProcessor' less than -source '1.8'"
You can't do anything about it in JMRI, but it can be done in Apache NetBeans project (JMRI uses org.openide.lookup library). The annotation processor could (finally !!) declare RELEASE_8, as NetBeans already supports just JDK8+ for compilation.

-Svata




--
Andrew Crosland