Change the NetBeans Default JDK
A client sent me some code today to update. He was using the NetBeans, so I downloaded the IDE and fired it up to open the project he’d sent me. Unfortunately, the project wouldn’t compile because he’d written the code in Java 6 while NetBeans was using Java 5. I couldn’t find a NetBeans menu to update the setting, but rather found that the fix is to add the following in NetBean’s etc/netbeans.conf file:
# Default location of JDK, can be overridden by using –jdkhome <dir>:
netbeans_jdkhome=”C:\Program Files\Java\jdk1.6.0_05″
Tags: NetBeans
Martin said,
January 31, 2009 at 3:15 pm
Thanks ! Useful !
Lloyd said,
February 15, 2009 at 3:33 pm
Thanks I nearly went insane looking through the oprions to change the default jdk
ashish said,
May 14, 2009 at 7:44 am
Thanks a million buddy this was great. I had to other way round 1.6 -> 1.5
Matt said,
August 13, 2009 at 11:02 am
Thanks a bunch, saved me a lot of time.
Sterling said,
August 30, 2009 at 10:07 pm
Whenever I run that command it says “File not found”. My path is
C:\Java\jre6\jdk1.6.0_12
Is it because I’m pointing to a folder? Do I need to RUN netbeans.conf? Whenever I try to do that, I don’t have the right program to run it and the web can’t find one apparently.
Ben said,
August 31, 2009 at 8:28 am
Sterling, it’s not a command that you run. You need to open netbeans.conf in a text editor such as NotePad or WordPad and add that line to the file. You do not need to run netbeans.conf. When NetBeans starts up, it will look in that file to see which JDK it should point to.
Darryl said,
October 29, 2009 at 7:52 am
Thanks so much! This was really useful!
sugih said,
January 19, 2010 at 2:11 pm
Thanks for sharing! It works after I followed your comment on Sterling’s
Black said,
February 10, 2010 at 6:00 pm
Muchas gracias, andaba buscando una solucion para IDE netbeans al instalar una nueva version de JDK
Pietro said,
March 25, 2010 at 3:46 am
great trick! Thank you
ymtoh said,
April 21, 2010 at 1:39 am
thanx mate.. i was looking for the configuration insanely…
Man0z said,
June 1, 2010 at 12:31 am
thx a lot! very useful
James Pridgen said,
June 15, 2010 at 5:48 am
Thanks for that…I just had the same problem.
Andrei said,
August 28, 2010 at 10:07 pm
you can change your default path by editing netbeansdir/etc/netbeans.conf str8 forward from there
samuel said,
October 22, 2010 at 7:05 pm
wow that’s great!!
thanks for this
Matara said,
January 18, 2011 at 11:56 am
That is a great tip! Saved me hours of my time. Thanks a lot.
Lotus Esprit said,
January 20, 2011 at 9:15 am
Worked for me too — thanks for sharing. Since my install dir was customized, I found the file here: C:\apps\NetBeans_6_9_1\etc\netbeans.conf
Panha said,
January 27, 2011 at 6:58 pm
Big help!!!
thz…
Paul said,
January 31, 2011 at 8:11 pm
How i can edit that file??????????
I was unable to edit the file, whir word or WHAT??
help
Ben said,
January 31, 2011 at 8:15 pm
Paul, if you’re on Windows, you can use Notepad, Wordpad, or download another text editor like Notepad++.
likid said,
March 14, 2011 at 11:02 am
thanks, really useful
med said,
May 10, 2011 at 3:34 am
merci infiniment.
Selvas said,
May 17, 2011 at 11:53 pm
You are a life server! In Africa we say ‘zikomo’ meaning thank you
Namrat Dhane said,
June 9, 2011 at 5:24 am
thanks a lots .. its worked
J Srinivas said,
June 15, 2011 at 10:30 pm
Thanks a lot.Its work for me
Gumuruh Ssp Jayadilaga said,
August 25, 2011 at 4:24 pm
exactly! thanks a thousand dude!
TBingham said,
February 3, 2012 at 8:15 am
It worked. Woohoo!