1

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:

source

but 14 is available as a platform:

14

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.

2
  • 1
    Please check this question and the answers to it. Maybe can help you to install the sources for Java 14: askubuntu.com/questions/755853/how-to-install-jdk-sources/… After you install them you have to check out how to include them in Netbeans. Maybe they will appear automatically but I am not sure because I do not use this IDE.
    – Level_Up
    May 18, 2020 at 8:08
  • I am using java 14 as here: stackoverflow.com/q/61849514/262852 so gradle is compiling and running java-records, which are only in version 14. But, the IDE is partially stuck on 11. As in the screenshots, the IDE shows 14 and 11.
    – Thufir
    May 18, 2020 at 9:19

1 Answer 1

1

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 ;)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .