Jiří Mačák
Jiří Mačák

Reputation: 301

Netbeans IDE - invalid jdkhome specified

Netbeans 8.0.2 shows this error on startup Netbeans 8.0.2 error on startup. I searched for this error, but nothing works for me.

I modified the netbeans_jdkhome in netbeans.conf file, but nothing. Then uncommented it, nothing. The error keeps showing up. It´s like there is another netbeans.conf file, but I don´t know where. I´m running Windows 10 and have JDK 1.8 installed in "C:\Program Files\Java\jdk1.8.0_101" .

Upvotes: 20

Views: 37024

Answers (9)

Asfixia
Asfixia

Reputation: 1

I have an easier solution by just passing the parameter --jdkhome to netbeans executable (inside './bin' folder):

netbeans64.exe --jdkhome %JAVA_HOME%

You can create a runNetbeans.bat file at netbeans root directory with the following content:

%~dp0/bin/netbeans64.exe --jdkhome %JAVA_HOME%

PS: You can pass the directory of your JDK, replacing the JAVA_HOME environment. PS2: Tested on Netbeans 12.

Upvotes: 0

GavenJr
GavenJr

Reputation: 1

If you cant edit netbeans.conf for some reason, try re-installing netbeans

Upvotes: 0

Congdar
Congdar

Reputation: 61

You may have a problem getting your edit to stick because you need Administrator Privilege to edit the netbeans.conf file.

Windows 10:

  1. left mouse-click on the windows button on the task bar
  2. type cmd.exe
  3. windows search should list "Command Prompt - Desktop App"
  4. right mouse-click on "Command Prompt - Desktop App"
  5. select "run as administrator"
  6. select the Yes button from User Account Control dialog box
  7. from the command prompt change directory to where the netbeans.conf file is.
  8. CD "C:\Program Files\NetBeans 8.0.2\etc"
  9. type: notepad netbeans.conf
  10. search for netbeans_jdkhome=
  11. add the path to your jdk: netbeans_jdkhome="C:\Program Files\Java\jdk1.8.0_181"
  12. save netbeans.conf
  13. start Netbeans

Upvotes: 6

js2010
js2010

Reputation: 27423

First attempt at a powershell solution.

# fix path to jdk in netbeans.conf
# netbeans doesn't like unicode (utf-16)    

$conf = Get-Content 'C:\Program Files (x86)\NetBeans 8.2\etc\netbeans.conf'

# string version of $jdk will have last dir found if there's more than one
$jdk = get-item 'C:\Program Files (x86)\Java\jdk*'

# `" to embed "
set-content 'C:\Program Files (x86)\NetBeans 8.2\etc\netbeans.conf' (
  $conf -replace 'netbeans_jdkhome=.*',"netbeans_jdkhome=`"$jdk`"")

if (-not $?) { exit 1 }

Upvotes: 0

Nixon Nelson
Nixon Nelson

Reputation: 41

I found a decent solution for Windows users.

Go to your NetBeans install folder (for instance: C:\Program Files\NetBeans 8.0.2\etc), open the file netbeans.conf then just comment out the line:

netbeans_jdkhome="C:\Program Files\Java\jdk1.8.0_101"

to

#netbeans_jdkhome="C:\Program Files\Java\jdk1.8.0_101"

The '#' is for comment. You will see this in the file.

Then just run the NetBeans IDE as usual.

Upvotes: 3

Hornigold Arthur
Hornigold Arthur

Reputation: 77

You cannot just run netbeans64. You have to manually edit the CONF file in netbeans\etc folder. And set jdkhome variable. Then the installation goes smoothly.

Ignore all my previous comments. Sorry.

Upvotes: 0

user9575756
user9575756

Reputation: 1

To fix Netbeans IDE - invalid jdkhome specified just find your netbeans.config and change the file path, like below:

netbeans_jdkhome="C:\Program Files\Java\jdk1.8.0_161"

netbeans_jdkhome="C:\Program Files\Java\jdk-10"

Upvotes: 0

CY15
CY15

Reputation: 381

go to C:\Program Files\NetBeans 8.0.2\etc, open the file netbeans.conf then change netbeans_jdkhome to the path of your JDK, netbeans_jdkhome="C:\Program Files\Java\jdk1.8.0_101"

if you are not sure about the version of jdk, you can find it by typing in CMD java -version

Upvotes: 38

learp
learp

Reputation: 153

Try to set environment variable in cmd:

setx JAVA_HOME C:\Program Files\Java\jdk1.8.0_101

I think you alredy have JAVA_HOME, but path is C:\Program Files\Java\jdk1.7.0_15.
You can check it in cmd. Just type it:

set JAVA_HOME 

Upvotes: 1

Related Questions