From the console javac
builds with JDK 14 fine.
Using sdkman
to install JDK
14 as:
thufir@dur:~$
thufir@dur:~$ which java
/home/thufir/.sdkman/candidates/java/current/bin/java
thufir@dur:~$
thufir@dur:~$ java -version
openjdk version "14.0.1" 2020-04-14
OpenJDK Runtime Environment AdoptOpenJDK (build 14.0.1+7)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 14.0.1+7, mixed mode, sharing)
thufir@dur:~$
thufir@dur:~$ javac -version
javac 14.0.1
thufir@dur:~$
Netbeans only shows the sources
as 11:
but 14 is available as a platform:
How can I set 14 as the default platform (or even remove 11), but, more importantly, set 14 as the sources
version for the project as in the first screenshot?
see also:
how to use Java 9 zulu from sdkman?
even creating a new project still shows the source binary as 11 and not 14 with no way to select 14. Ideally, would remove 11 entirely and just go to 14.
In your Projects tree, expand the Build Scripts and edit the build.gradle file.
You should find somewhere a line that contains :
sourceCompatibility = '11'
Edit this line and change it to
sourceCompatibility = '14'
.Clean and build your project, and re-open the project properties. You should now see your Source / Binary format to 14.
By the way, this information does not mean that your IDE is stuck on 11. It is just the target JVM version of your application. Having '11' will keep your code compatible with a JVM 11.
If your code is intended to run on a server for which you or a sysadmin manage the JVM version, you can choose the version you prefer and benefit from the latest JVM updates.
But if you plan to distribute a rich-client application that will run on a config that you don't know, I would rather consider keeping this compatibility as "old" as possible. Some people still have a JVM 1.8 on their computers, and probably not a majority uses Java 14 ;)