NetBeans invalid jdkhome specified fix
If you use NetBeans as an IDE then you probably came across the following error, "Cannot locate java installation in specified jdkhome"
.
This usually happens after you uninstall the java jdk which you used to use (usually happens after you update java).
There’s is an easy way to fix this. Navigate to your NetBeans installation folder which by default should be C:\Program Files\NetBeans and look for the folder etc. Inside that folder should be a file with the name netbeans.conf. What you need to do is to open the file with your favorite text reader (notepad as an example) and look for the line that starts with netbeans_jdkhome=.
You simply need to modify the line in order to point Netbeans to the the location of the java jdk version you are currently have installed. It should look something like this netbeans_jdkhome=”C:\Program Files\Java\jdk1.7.0_05″. If you are unsure what version you have installed navigate to your java’s installation folder (the default path is C:\Program Files\Java) and look for folder there.
If you are having issues editing the file because of UAC and the lack of administration rights and you are unsure on how to resolve that, read How to edit a file in Program Files. That should hopefully help you out.
Make sure to save the file after you are done editing it. Fire up NetBeans, the error should be gone.
Happy coding!
Thanks!
Thank you! Helped well.
This method does not work on my 64-bit Windows 7 machine where NB 8.2 was originally installed with Java 1.8.0_121, but which I’ve now replaced with 1.8.0_131. netbeans64.exe still identifies 1.8.0_121 as the “java installation in specified jdkhome”, even after I’ve updated netbeans.conf to refer to release _131.
It’s happens also with Netbeans 8.0.2
Remove this stupid entry and problems gone…
# Default location of JDK:
# (set by installer or commented out if launcher should decide)
#
# It can be overridden on command line by using –jdkhome
# Be careful when changing jdkhome.
# There are two NetBeans launchers for Windows (32-bit and 64-bit) and
# installer points to one of those in the NetBeans application shortcut
# based on the Java version selected at installation time.
#
thanks a lot
Paul, thanks.
Another option is to comment out the line starting with “netbeans_jdkhome = “. That will force the launcher to choose from the installed JDKs and it should choose the most recent one. Commenting out the line frees you from having to edit netbeans.conf each time the JDK is updated (and the old JDK removed).
Thanks a lot
Thanks. Its really Help me lot.
Thanks very much, this is exactly the information I was looking for! As someone else mentioned, you may want to update the instructions to mention to run notepad/wordpad as administrator if you’re using windows 7, however.
Thanks for the recommendation John.
I’ve published a small post that will hopefully help people that are facing these kind of issues and updated this post to include it.
That worked like a charm, thank you.
I like this site so much, saved to favorites.
Thanks!!!
You need to have administrator rights in order to edit the file. Run your text software as administrator. Assuming it’s notepad under Windows 7 here’s an idea of what you need to do. Click Start > All Programs > Accessories , right-click Notepad , and click Run as administrator, then simply open netbeans.conf, modify it and hit save.
my access to the file is denied…and so i can’t replace the path,,what should i do?
Save it with “netbeans.conf” elsewhere, then copy and replace the origina “netbeans.conf” file located inside the “C:\Program Files\NetBeans-19\netbeans\etc”.
I just want to say I’m beginner to weblog and certainly savored your page. More than likely I’m planning to bookmark your blog . You absolutely come with superb well written articles. Thanks for revealing your website.
Thank you for another informative site. The place else could I get that type of information written in such a perfect means? I’ve a project that I’m simply now running on, and I’ve been at the glance out for such information.