Cannot find java. Use the switch --jdkhome

I just installed Netbeans 8.0.2 on CentOS 6.5.

When I try to run it, I get a message

Cannot find java. Please use the --jdkhome switch 

I have / usr / share / java -1.7.0, so I typed

 /usr/local/netbeans-8.0.2/bin/netbeans --jdkhome /usr/share/java-1.7.0 

and still got

 Cannot find java. Please use the --jdkhome switch 

I also have / root / Downloads / jdk 1.8.0_40, which allowed me to install Netbeans. However, when I print

 /usr/local/netbeans-8.0.2/bin/netbeans --jdkhome /root/Downloads/jdk1.8.0_40 

I'm still getting

 Cannot find java. Please use the --jdkhome switch 

I tried

 whereis java 

and received

 java: /usr/bin/java /etc/java /usr/lib/java /usr/share/java /usr/share/man/man1/java.1.gz 

but

 /usr/local/netbeans-8.0.2/bin/netbeans --jdkhome /usr/bin/java 

still producing

 Cannot find java. Please use the --jdkhome switch. 
+21
source share
8 answers

I recommend that you change the JDK configuration used by NetBeans in the netbeans.conf configuration file :

 netbeans_jdkhome="C:\Program Files\Java\..." 
+28
source
  • Go to the netbeans installation directory
  • Find the configuration file [installation directory] /etc/netbeans.conf
  • near the end, find the line netbeans_jdkhome = ...
  • comment on this line using '#'
  • now run netbeans. launcher will find jdk (environment variable $ JDK_HOME / $ JAVA_HOME)

Example:

 sudo vim /usr/local/netbeans-8.2/etc/netbeans.conf 
+21
source

Check the setting in user configuration /home/username/.netbeans/version/etc/netbeans.conf

I had a problem when I specified a location around the world, but my user setting overrided the global settings.

CentOS 7 / Netbeans 8.1

+2
source

Try Java SE Runtime Environment 8. He fixed it for me.

+2
source

NetBeans 8.2 - Can't find java installation in specified jdkhome?

Answer: edit the netbeans.conf file.

Close NetBeans, start Notepad or another text editor as an administrator. Right-click Notepad and select Run as Administrator, and then open netbeans.conf. Edit netbeans_jdkhome = "C: \ Program Files ... whatever".

+1
source

MAC USERS


First, remember that on a Mac, the netbeans.conf file is stored in

 /Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/etc/netbeans.conf 

(if you used the default installation package).

Then also remember that the directory you SHOULD use on "netbeans_jdkhome " or "--jdkhome" is NOT /Library/Java/JavaVirtualMachines/jdk1.8.0_172.jdk/, but the following :

 /Library/Java/JavaVirtualMachines/jdk1.8.0_172.jdk/Contents/Home //<-- Please, notice the /Contents/Home at the end. That the "trick"! 

Note. Of course, you must change the versions for NetBeans and the JDK that you use.

+1
source

In Netbeans 10, commenting out the netbeans_jdkhome parameter in .../etc/netbeans.conf no longer does the job. You must specify the correct directory depending on the 32/64 bit.

For example, for a 64-bit application: netbeans_jdkhome="C:\Program Files\AdoptOpenJDK\jdk8u202-b08"

0
source

What worked for me:

  • Make sure the java path is accessible:
 $ which java /usr/bin/java 
  • then in etc / netbeans.conf make sure netbeans_jdkhome commented out
  • in Finder go to / bin / click on NetBeans (terminal icon)

You expect ./netbeans --jdkhome=/usr/bin/java work, but for some reason this is not happening.

0
source

Source: https://habr.com/ru/post/983798/


All Articles