10

I have JDK 1.6, JRE6 and JRE7 (64-bit & 32-bit) installed in my PC.

I am using Netbeans 7.3 BETA 2 and it is using JDK 6 and JRE 6.

I want to change it to JRE7. How can i achieve this ?

I have checked in Stackoverflow itself and found that we have to change the netbeans.conf file content for the netbeans_jdkhome value to the path of new Java path.

In another stackoverflow question, I found How to specify which JRE to use in Netbeans?.

But, in this also, I am not able to find how to get this resolved. Can anybody help on this ?

My installation path is as follows,

JDK6 path - C:\Program Files (x86)\Java\jdk1.6.0_31

JRE6 path - C:\Program Files (x86)\Java\jre6

JRE7 path - C:\Program Files (x86)\Java\jre7 (32-bit)

JRE7 path - C:\Program Files\Java\jre7 (64-bit)

Thanks in advance.

Community
  • 1
  • 1
Dinesh
  • 16,014
  • 23
  • 80
  • 122

1 Answers1

21

Goto Tools -> Platforms

enter image description here

Click "Add Platform", browse to the location where the JDK you want to add is installed....

enter image description here

Click on the JDK you want to add and select "Finish"

Updating projects

You can change the platform that projects use, by right clicking the project node and selecting properties and selecting Libraries. Here you change the platform that the project will use to build the classes with.

enter image description here

You can also change the source/binary format (version) which Netbeans is expecting to use. For example, you use JDK 7, but build/develop for Java 6

enter image description here

Changing the JDK that Netbeans itself uses to run

Goto {install/location/of/Netbeans}/etc and open the netbeans.conf.

There is a property called netbeans_jdkhome (it was towards the end of my file). You change this to what ever JDK you want Netbeans to be launched with

Joop Eggen
  • 107,315
  • 7
  • 83
  • 138
MadProgrammer
  • 343,457
  • 22
  • 230
  • 366
  • So, Can't I add JRE alone ? So, Do I required to install JDK 7 separately ? – Dinesh Jul 12 '13 at 08:02
  • 2
    @Dinesh No, you can't just tell Netbeans to use a specific JRE, it only works with JDKs – MadProgrammer Jul 12 '13 at 08:03
  • 2
    @johnchen902 I use to have JDK 3, 4 & 5! – MadProgrammer Jul 12 '13 at 08:03
  • @MadProgrammer It depends on the NetBeans bundle. The PHP variant for instance can be run with the JRE and without the JDK. Then, however, you must configure it via `netbeans.conf` because `Tools -> Platforms` is not available. – twigmac Apr 24 '17 at 20:58
  • @twigmac I wouldn't say that was the question – MadProgrammer Apr 24 '17 at 21:28
  • @MadProgrammer I wasn't so much referring to the question itself but rather to [your answer to Dinesh's comment](http://stackoverflow.com/questions/17610167/setting-jre-in-netbeans/17610225#comment25632613_17610225). With some NetBeans bundles you can do just that: tell Netbeans to use a specific JRE (not JDK) and it works. In addition, the question hasn't been explicitly asked for a Java NetBeans bundle, so folks using HTML/PHP/C/C++ bundles are led here, too. – twigmac Apr 30 '17 at 23:34
  • @twigmac Then we're talking about two different things :P – MadProgrammer Apr 30 '17 at 23:37