Changing Java Platform on Which Netbeans Runs

Changing java platform on which netbeans runs

You can change the JDK for Netbeans by modifying the config file:

  1. Open netbeans.conf file available under etc folder inside the NetBeans installation.
  2. Modify the netbeans_jdkhome variable to point to new JDK path, and then
  3. Restart your Netbeans.

How can I set the default Java platform in NetBeans 8.2?

For now, it appears there isn't any way to override it. Here is NetBeans Help about the Java Platform Manager:

Use to register different versions of the Java Development Kit (JDK) and other Java tools that your programs depend on. The dialog box lists all of your registered JDKs in the left pane and lists the JDK that the IDE is running on as the Default Platform.

So I'll have to change platform for each project, because NetBeans 8.2 can not run with JDK 1.7 (so I can't set it as the default platform).

There is a recent plugin that allows to right-click Maven projects to set the JDK (still cannot set it by default).

How can I set the JDK NetBeans runs on?

Thanks to Kasun Gajasinghe's tip, I found the solution in the "suggested" link. Update the following file (replace 7.x with your NetBeans version):

C:\Program Files\NetBeans 7.x\etc\netbeans.conf

Change the following line to point it where your Java installation is:

netbeans_jdkhome="C:\Program Files\Java\jdk1.7xxxxx"

You may need administrator privileges to edit netbeans.conf.

How can I change the default SDK for Netbeans 12.2?

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 Files\NetBeans-12.2\netbeans\etc\netbeans.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.

Change JRE in a NetBeans project

  • In the Project tab, right-click on the project and select Properties. In the Library category select Java Platform JDK 1.6.
  • Then, in the Source category select Source/Binary Format JDK6.
  • This assumes that you installed JDK 1.6 and NetBeans knows about
    this.
  • JDK 1.6 must be known to NetBeans as a Java Platform.
  • From the menu select menu ToolsJava Platform Manager.
  • If JDK 1.6 is not in the list, you can add it there.


Related Topics



Leave a reply



Submit