Netbeans IDE - invalid jdkhome specified

与世无争的帅哥 提交于 2019-12-08 15:13:10

问题


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" .


回答1:


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




回答2:


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



回答3:


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 



回答4:


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"




回答5:


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.




回答6:


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.




回答7:


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 }


来源:https://stackoverflow.com/questions/39956102/netbeans-ide-invalid-jdkhome-specified

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!