52

Possible Duplicate:
Changing Java platform on which Netbeans runs

Here is an image of my default JDK (which is 1.6) and the JDK I want to set as default (which is 1.7)

http://tinypic.com/view.php?pic=35ldlye&s=5

Community
  • 1
  • 1
Hrfpkj
  • 691
  • 2
  • 6
  • 13
  • this platform is by default used by instalation of..., but this isn't any problem, you can change JDK directly in the project properties, then clean and build project – mKorbel Apr 13 '12 at 19:08
  • Tools -->Platforms-->Add what ever java version you want there and remove other java versions. – kosa Apr 13 '12 at 19:09
  • This [question](http://stackoverflow.com/questions/2809366/changing-the-version-on-which-netbeans-runs) has been [asked](http://stackoverflow.com/questions/6950960/how-to-point-netbeans-to-new-jdk) [before](http://stackoverflow.com/questions/504087/where-can-i-set-the-jre-jdk-which-is-used-to-run-netbeans-besides-the-command-li). – Beau Grantham Apr 13 '12 at 19:09
  • It's also a NetBeans FAQ: http://wiki.netbeans.org/FaqJdkHome –  Apr 13 '12 at 19:32
  • 2
    I don't believe this is a duplicate question. They are asking about how to change the default java jdk used, which is the project properties->libraries->java platform used for the project, not by the ide. And if you work with different people using different installations, you can't just change the java platform, that will lead to commit wars. – vextorspace Feb 13 '19 at 16:03
  • This is not a duplicate question and I can't create an answer (good job S.O.) Answer: There is a misconception about what the (Default) means against the Tools->Java Platform->Platforms list. "Default" in this window means 2 things. 1) The platform that is used to run and compile any project that doesn't have an override specified 2) The platform that Netbeans itself runs on. Unfortunately, THERE IS NO WAY TO SEPARATE THE TWO. If you change the default you are changing both the runtime AND the project default. – Ben Seidel Sep 30 '21 at 04:54
  • @vextorspace To prevent "Commit wars" have everyone load and name the target JDK the same thing in the Platform Manager. We use "Development" in our projects. Then set all projects to use that platform. As the platform name is stored in the project XML and used to select the JDK, you can use whatever JDK you want - without changing the project files. Just register the JDK using that name. You can also use Junctions & Symbolic Links to change the target platform without having to remove and re-create the platform registration if you need to test & run it on multiple JDK versions. – Ben Seidel Sep 30 '21 at 05:07

1 Answers1

93

If I remember correctly, you'll need to set the netbeans_jdkhome property in your netbeans config file. Should be in your etc/netbeans.conf file.

Ahmed Ashour
  • 5,179
  • 10
  • 35
  • 56
Michael
  • 2,624
  • 2
  • 19
  • 16
  • 12
    Correct. The jdk identified by jdkhome is the default home. It can also be defined on the commandline by passing `--jdkhome /path/to/jdk` –  Apr 13 '12 at 19:31
  • This works. I got the path from the java platform master then I put it in the netbeans.conf file. – Hrfpkj Apr 16 '12 at 16:41
  • 7
    NOTE! this will also change the java runtime version for netbeans! Therefore, if you want your projects to run in java 1.6, but you have netbeans 7.3 or higher (which will only run without crashing in 1.7), DO NOT CHANGE THIS VALUE TO 1.6. As an alternative, which I recommend, set your java projects to maven projects and set the build version to 1.6 in the pom file of the maven project. – planty182 Oct 25 '13 at 09:35
  • In my Linux installation of Netbeans 8.0 I don't see any netbeans.conf file ! – incises Jan 28 '15 at 10:54
  • 1
    @incises - I see the `/etc/netbeans.conf` in my Linux – HEKTO Jul 24 '15 at 18:49
  • for netbeans platform, have you an idea where we configure the version of the platform ? I want upgrade from 8.0.2 to 8.2 – Aguid Oct 12 '17 at 08:24