Netbeans is not getting installed in my Mac, it says JDK not found, though JDK is installed in the same

Tags: ,



Error: Failure while executing the commands mentioned below:-

/usr/bin/sudo -E -- env LOGNAME=ajaygautam USER=ajaygautam USERNAME=ajaygautam /usr/sbin/installer -pkg /usr/local/Caskroom/netbeans/8.2/NetBeans 8.2.pkg -target / exited with 1.

Here’s the output: installer: Error – 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.

Would someone in tracing out the issue above? I’m not able to install NetBeans 8.2 package in my Mac.

Answer

Actually, java_home is in

/System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java_home

but in my case, java_home was in the next location i.e

/System/Library/Frameworks/JavaVM.framework/Versions/A/Commands/java_home 
  • I deleted my java_home from /usr/libexec/java_home by root user

  • added new java_home in /usr/libexec by following command

    sudo ln -s /System/Library/Frameworks/JavaVM.framework/Versions/A/Commands/java_home /usr/libexec/.
    


Source: stackoverflow