Just.Me.

Netbeans and default JDK

Since Netbeans 6.1 for Mac OS X still comes with JDK 1.5 and I wanted 1.6 I went to Tools > Java Platforms and added 1.6 (/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home). But if I wanted to change 1.6 to the default JDK it just wasn’t possible from within Netbeans itself. Browsing the Help-section I found this interesting piece:

You can set the IDE’s default platform by running the IDE with the –jdkhome switch on the command line or by entering the path to the JDK in the netbeans_j2sdkhome property of your INSTALLATION_DIRECTORY/etc/netbeans.conf file.

Since I didn’t wanted to start Netbeans with an extra parameter I went to my Applications folder and right clicked on Netbeans 6.1.app choosing “Show Package contents”. Navigating to Contents/Resources/etc/ I found the said netbeans.conf. Inside there was this line:

# Default location of JDK, can be overridden by using --jdkhome < dir >:
netbeans_jdkhome=/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home

Just changed it too /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home and restarted Netbeans et voila: 1.6 was the default JDK.

Update: In Netbeans 6.5 netbeans.conf can be found in Contents/Resources/NetBeans/etc

24 Responses to “Netbeans and default JDK”

  1. silverprince Says:
    June 23rd, 2008 at 15:08

    This is just what I was looking for.
    I have been pulling my hair out for two hours.
    Thank you for sharing this.

    silverprince
    sydney, australia

  2. the sarcastic programmer Says:
    July 6th, 2008 at 21:53

    Thanks for the tip! With all the wonderful things that NetBeans can do, its amazing how a simple thing like setting the default JDK is overlooked. I use NetBeans for my java class I teach and having to change the JDK in the properties every time is REALLY annoying (almost all my students use a PC to write their code, but I use a Mac for marking).
    I love the internet.

  3. I find this blog very interesting, i will be here everyday till now. Greetings

  4. Excellent tip - this is exactly what I was after (most searches turned up results telling me how to add another platform to build/compile to - but not how to change the platform NetBeans actually runs on). Strange that you can’t do this within the IDE itself - but you’ve saved me some time! Thanks.

  5. thanks a lot. this is what i was looking for. i tried to figure out the problem by view so many web sites by googling but no luck until i found this. thanks once again.
    razi

  6. Brian O'Sullivan Says:
    February 14th, 2009 at 0:45

    Thank you so much. I am a .Net developer trying to learn Java. I got an excellent book ‘Murach’s Java SE6′ but until your comment I had to go changing settings for every project!!! Thank you so much!!!

  7. Thanks. I needed this

  8. Thnks!

  9. Your blog is very interresting for me, i will come back here..

  10. XH5mG6 cool, i will bookmark it,

  11. How long have you been blogging…your good at it.

  12. I really see the logic in your argument but I think you’ve painted your strokes

  13. Взял себе :)

  14. просто супер. заставляет задуматься.. спасибо!

  15. Супер, мне кажется это отличная мысль

  16. Вот это да! Крутая статейка!

  17. Хороший материал у вас тут опубликован, все интересно и грамотно изложено, за что вас благодарю. Пишите еще, я подписался на rss-ленту.

  18. Великолепный пост здесь у вас написан, всё очень интересно и грамотно изложено, за что вас благодарю. Пишите еще, я подписался на rss-ленту.

  19. Возможно такое будет реализвано через 3-5 лет. Работать надо!)

  20. I find this blog very interesting, i will be here everyday till now. Greetings

  21. >> I find this blog very interesting, i will be here everyday till now. Greetings
    It agree! Write still!

  22. gives use a perfect website decent Gives thanks for the working hard to assist me

  23. Hasslem, Miller, and 3 second round picks……ya they are concerned. Only production coming out of them is the amount of fouls they can use.

  24. Thanks a lot for providing such an excellent information!

Leave a Reply