Installing Netbeans 8.2 on MacOS Big Sur no JDK found

淺唱寂寞╮ 提交于 2020-12-15 06:05:34

问题


I have recently upgraded into MacOS Big Sur and when tried to open NetBeans 8.2 it gave an error

The JDK is missing and is required to run some NetBeans modules. Please use the --JDK home command-line option to specify a JDK installation

I tried setting JAVA_HOME to the JDK path but it didn't work. So, I uninstalled Netbeans and JDK and re-downloaded Netbeans 8.2 and JDK 8.

Now when trying to set up the Netbeans, it shows :

NetBeans IDE cannot be installed. Java (JRE) found on your computer but JDK 8 or newer is required. Please download and install the latest update of JDK 8 from http://www.oracle.com/technetwork/java/javase/downloads/index.html and restart NetBeans installation.

Java -version

java version "1.8.0_271"
Java(TM) SE Runtime Environment (build 1.8.0_271-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.271-b09, mixed mode)

Javac -version

javac 1.8.0_271

My current $JAVA_HOME is set to/Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home

I also tried installing NetBeans 11 and 12 with JDK 14 and 15 but it gives the same error

EDIT: Following is the only solution that worked for me.

/Applications/NetBeans/Apache\ NetBeans\ 12.1.app/Contents/Resources/NetBeans/netbeans/bin/netbeans --jdkhome /Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home
  1. Paste the above command on terminal. It opens the NetBeans. To use the NetBeans without typing the command again save the above command on a code editor and save as NetBeans.command file.

  2. Then open the file. Click okay on the prompted message. Type following command on the terminal.

    sudo passwd root

  3. Type your login password.

  4. Just press Enter (you don't have to type a new password)

  5. Type su root and your login password again.

  6. Type chmod +x <path of the file you saved with .command>. Quit the terminal and open the saved file. It should work now.


回答1:


This worked for me: Start Java from fresh installation.

sudo rm -rf /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
sudo rm -rf /Library/Java/JavaVirtualMachines
sudo rm -rf /Library/Application\ Support/Oracle/Java/
sudo rm -rf /Library/PreferencePanes/JavaControlPanel.prefPane

Restart computer.

Download and install Java jdk-8u271-macosx-x64 Restart computer.

Download and install NetBeans 12.1 from Appache Netbeans (sorry, Netbeans 8.2 didn’t worked anymore for me, though I tried at first).

Open Netbeans, do acepte import Netbeans 8.2 preferences. Go to Netbeans Preferences pane under Netbeans menu. Click on Java icon, then click on Java Shell... wait until Netbeans responds. Do accept any dialog (I forgot, but some dialog appears). Netbeans will complain about jdk not being found; exit Netbeans. Open file /Applications/NetBeans/NetBeans 12.1.app/Contents/Resources/NetBeans/etc/netbeans.conf with bbedit or something alike. Find and edit line to this:

netbeans_jdkhome="/Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home"

Save file. Open Netbeans; go to Netbeans Preferences pane under Netbeans menu. Click on Java icon, then click on Java Shell. It may stay at blank square. Close Preferences Pane; go to Tools menu: You’ll see Java Platforms menu, go into it. There you have, all Java installment.

Hepoe this helps.




回答2:


I had the same problem. I have not needed to restart the computer. I have simply changed the line:

netbeans_jdkhome="/Library/Java/JavaVirtualMachines/jdk1.8.0_211.jdk/Contents/Home"

in the file netbeans.conf, from the directory:

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

and this has worked for me




回答3:


Its just the issue with netbeans jdk home path not to worry try this -

Step 1 - Open Terminal

/usr/libexec/java_home

Output - /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home

Copy this path as you have to save this in netbeans.conf

Step 2 - In terminal use this

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

search for netbeansjdkhome and paste the path you copied in STEP 1

Finally it should look like this -

netbeansjdkhome="/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home"

Step 3 - Restart and open Netbeans 8.2 it will work fine now.




回答4:


It's actually quite easy! But it was really hard to figure it out!

i'll tell it step by step:

STEP 1: First of all you have to make sure you set JAVA_HOME like this (depending on the version you have installed:

export JAVA_HOME=$(/usr/libexec/java_home -v "1.8.0_275")

If you're just not sure what jdk version you have installed in, just do this:

/usr/libexec/java_home -V

STEP 2: Ok, now you have to download the whatever netbeans version you wanna install from apache's website. I needed 11.1.

STEP 3: Open up the dmg file and copy the pkg file into your home directory (you can use finder or whatever you want).

STEP 4: Execute the following command on your home directory (make sure to replace youruser and yourpkgfilename.pkg with the right information):

/usr/bin/sudo -E -- /usr/bin/env LOGNAME=youruser USER=youruser USERNAME=youruser /usr/sbin/installer -pkg yourpkgfilename.pkg -target /

You should get this output:

installer: Package name is Apache NetBeans IDE 11.1
installer: Installing at base path /
installer: The install was successful.

PS: See, i've signed UP to this RIGHT NOW, just to make sure to help everybody in the same problem here, i would really appreciate to be voted as the right solution if this really helps you ok?



来源:https://stackoverflow.com/questions/64494505/installing-netbeans-8-2-on-macos-big-sur-no-jdk-found

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