How can I change the default SDK for Netbeans 12.2?

Tags: ,



When setting up Netbeans 12.2, one part of the installer lets you select the JavaSDK that you’ll use as the Default. Is there any way to change this later on, like when a new version of the JavaSDK comes out?

Answer

It is possible to change the platform later.

You need to distinguish between two platforms:

  • the one that netbeans is running on (yes, it is a Java based IDE)
  • the one that will be used to compile your project

If you want to change the Java version for the IDE, check the configuration file in the netbeans/etc folder (on my windows machine it is C:Program FilesNetBeans-12.2netbeansetcnetbeans.conf. In line 76 I see the variable netbeans_jdkhome.

If you installed another JDK on your machine and want to choose that for projects, inside Netbeans go to Tools/Java Platforms. Add your new installation. Then when you go to some project’s properties, look at the Build/compile settings. Choose your new java platform, and it will be used for your project.



Source: stackoverflow