简体   繁体   English

Netbeans 没有安装在我的 Mac 上,它说 JDK not found,虽然 JDK 安装在同一个

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

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. /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.这是输出:安装程序:错误 - 无法安装 NetBeans IDE。 Java (JRE) found on your computer but JDK 8 or newer is required.在您的计算机上找到 Java (JRE),但需要 JDK 8 或更高版本。 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.请从http://www.oracle.com/technetwork/java/javase/downloads/index.html下载并安装最新的 JDK 8 更新,然后重新启动 NetBeans 安装。

Would someone in tracing out the issue above?有人会追查上述问题吗? I'm not able to install NetBeans 8.2 package in my Mac.我无法在我的 Mac 中安装 NetBeans 8.2 包。

I got the same problem and could to fix it with brew.我遇到了同样的问题,可以用 brew 修复它。

firstly install java JDK https://www.oracle.com/java/technologies/javase-downloads.html then run this in your terminal:首先安装 java JDK https://www.oracle.com/java/technologies/javase-downloads.html然后在你的终端中运行它:

brew install netbeans

it will install the latest version of netbeans.它将安装最新版本的 netbeans。

Download OpenJDK from Archived OpenJDK GA Releases .Archived OpenJDK GA Releases下载 OpenJDK。

This will give you a file such as openjdk-9.0.4_osx-x64_bin.tar .这将为您提供一个文件,例如openjdk-9.0.4_osx-x64_bin.tar Extract the tar file and copy it to the correct place in your machine.提取 tar 文件并将其复制到您机器中的正确位置。

tar -xf openjdk-9.0.4_osx-x64_bin.tar
sudo cp -r jdk-12.0.2.jdk /Library/Java/JavaVirtualMachines/

Now you can run the Netbeans installer.现在您可以运行 Netbeans 安装程序。

i just install using brew我只是使用 brew 安装

brew install netbeans

and now i can use the latest 12.4现在我可以使用最新的 12.4

The following steps are used to install NetBeans on MacOS :-以下步骤用于在MacOS上安装NetBeans :-

1) Download the Latest version 1) 下载最新版本

In order to install NetBeans on MacOS, we have to download the latest version of NetBeans by visiting its official website Ie https://netbeans.org/downloads/为了在 MacOS 上安装 NetBeans,我们必须通过访问其官方网站即https://netbeans.org/downloads/下载最新版本的 NetBeans

2) Mount the disk image file 2)挂载磁盘镜像文件

The dmg file which is downloaded from the official website of NetBeans is to be mounted to an installer.从 NetBeans 官方网站下载的 dmg 文件将被挂载到安装程序中。 This can be done with the following command:这可以通过以下命令完成:

$ hdiutil mount Downloads/netbeans-8.2-macosx.dmg $ hdiutil mount 下载/netbeans-8.2-macosx.dmg

3) Install the file 3) 安装文件

The file is mounted to the volumes directory which contains a package file (.pkg) which is installable by using the installer command.该文件安装到包含包文件 (.pkg) 的卷目录,该文件可使用安装程序命令安装。 The command needs superuser privileges for which, sudo is used.该命令需要使用 sudo 的超级用户权限。

$ sudo installer -pkg Volumes/ NetBeans\\ 8.2/NetBeans\\ 8.2.pkg -target / $ sudo installer -pkg Volumes/ NetBeans\\ 8.2/NetBeans\\ 8.2.pkg -target /

The file will be installed to the target root which is mentioned while installing the file.该文件将安装到安装文件时提到的目标根目录。

4) Unmount the file 4) 卸载文件

After the completion of installation process, we need to unmount the installer.安装过程完成后,我们需要卸载安装程序。 This can be done by using the option Unmount with hdiutil command.这可以通过使用选项 Unmount with hdiutil 命令来完成。

$ hdiutil unmount /Volumes/NetBeans\\ 8.2 $ hdiutil 卸载 /Volumes/NetBeans\\ 8.2

Well, we have done with the installation process of NetBeans 8.2 on MacOS.好了,我们已经完成了在 MacOS 上安装 NetBeans 8.2 的过程。

Actually, java_home is in实际上, java_home

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

but in my case, java_home was in the next location ie但就我而言, java_home位于下一个位置,即

/System/Library/Frameworks/JavaVM.framework/Versions/A/Commands/java_home 
  • I deleted my java_home from /usr/libexec/java_home by root user我用 root 用户从/usr/libexec/java_home删除了我的 java_home

  • added new java_home in /usr/libexec by following command通过以下命令在/usr/libexec添加了新的java_home

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

For some reason, some Netbeans versions for Mac OS do not detect the JDK contained in JRE.出于某种原因,Mac OS 的某些 Netbeans 版本没有检测到 JRE 中包含的 JDK。 For proper installation and running the application, you must have Java for Mac OS installed previously.为了正确安装和运行该应用程序,您必须事先安装了Java for Mac OS https://www.java.com/es/download/ https://www.java.com/es/download/

Install The Lates Version ONLY which is 12.1 as of now!仅安装 Lates 版本,截至目前为 12.1!

https://netbeans.apache.org/download/nb121/nb121.html https://netbeans.apache.org/download/nb121/nb121.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM