How to Set the Jdk Netbeans Runs On

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.

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

Where can I set the JRE/JDK which is used to run Netbeans besides the command line?

Try setting netbeans_jdkhome in {NetBeans directory}/etc/netbeans.conf.

# Default location of JDK, can be overridden by using --jdkhome :
netbeans_jdkhome="..." # (omitted path, as I have Java in a non-standard location)

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.

How to set a java compiler in Netbeans

Right click on your project --> Project Properties

Then in Sources set Source/Binary Format to JDK 7.

EDIT 1 :

There is a NetBeans issue:

Works fine in J2SE project, Web project specific problem.
The problem is that fork="false" the JDK 7.0 params are passed to JDK 6.0
compiler. The executable requires fork="true".

On the line 293 of build-iml.xml the

<javac 
debug="@{debug}"
deprecation="${javac.deprecation}" destdir="@{destdir}"
encoding="${source.encoding}"
excludes="@{excludes}"
executable="${platform.javac}"
fork="${javac.fork}"
includeantruntime="false"
includes="@{includes}"
source="${javac.source}"
srcdir="@{srcdir}"
target="${javac.target}"
tempdir="${java.io.tmpdir}">

should become:

<javac 
debug="@{debug}"
deprecation="${javac.deprecation}"
destdir="@{destdir}"
encoding="${source.encoding}"
excludes="@{excludes}"
executable="${platform.javac}"
fork="yes" ;as opposed to ${javac.fork}
includeantruntime="false"
includes="@{includes}"
source="${javac.source}"
srcdir="@{srcdir}"
target="${javac.target}"
tempdir="${java.io.tmpdir}">

EDIT 2 (if first tips don't work):

Try to run Netbeans IDE in JDK7.

Edit Netbeans conf file :

Linux

~/.netbeans/7.0/etc/app.conf

Mac Os X

/Applications/NetBeans/NetBeans\ 7.1.app/Contents/Resources/NetBeans/harness/etc/app.conf

Add the jdk7 path in the line jdkhome=.

Or

Launch netbeans using :

netbeans --jdkhome /Java7/Home/dir

Installing Netbeans 8.2 on MacOS Big Sur no JDK found

I had the same problem.
I have not needed to restart the computer.
I have simply changed the line:

netbeans_jdkhome="/Library/Java/JavaVirtualMachines/jdk1.8.0_211.jdk/Contents/Home"

in the file netbeans.conf, from the directory:

/Applications/NetBeans/NetBeans\ 8.2.app/Contents/Resources/NetBeans/etc/netbeans.conf

and this has worked for me



Related Topics



Leave a reply



Submit