简体   繁体   English

Netbeans 无法在 MacOS Big Sur 上安装

[英]Netbeans does not install on MacOS Big Sur

I have installed Big Sur on my MacBook Air.我已经在我的 MacBook Air 上安装了 Big Sur。 Java is installed but Netbeans install says no Java JDK found. Java 已安装,但 Netbeans 安装说没有找到 Java JDK。 Did anybody has the solution for this issue?有没有人有这个问题的解决方案?

Here's how I resolved it.这是我解决它的方法。 From the command line, I ran:从命令行,我运行:

/usr/libexec/java_home -V

This will output the Java VMs you have installed:这将 output Java 您已安装的虚拟机:

Matching Java Virtual Machines (4):
    14.0.1 (x86_64) "UNDEFINED" - "OpenJDK 14.0.1" /usr/local/Cellar/openjdk/14.0.1/libexec/openjdk.jdk/Contents/Home
    1.8.271.09 (x86_64) "Oracle Corporation" - "Java" /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
    1.8.0_271 (x86_64) "Oracle Corporation" - "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home
    1.8.0_251 (x86_64) "Oracle Corporation" - "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_251.jdk/Contents/Home

If you don't see JDK 1.8, then you should go to Oracle.com and install it.如果你没有看到 JDK 1.8,那么你应该 go 到Oracle.com并安装它。 Assuming you have 1.8, you should set that as your JAVA_HOME with the following command:假设您有 1.8,您应该使用以下命令将其设置为您的JAVA_HOME

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

Note that your location may be slightly different from mine, you should use the location for 1.8 that was present in your list of VMs when you ran /usr/libexec/java_home -V , above.请注意,您的位置可能与我的位置略有不同,您应该使用上面运行/usr/libexec/java_home -V时出现在 VM 列表中的 1.8 位置。 I would also recommend you add this to your shell profile so that the current JAVA_HOME is set the next time you reopen your shell.我还建议您将其添加到您的 shell 配置文件中,以便在您下次重新打开 shell 时设置当前的 JAVA_HOME。 I'm using ZSH as my shell, so the command was:我使用 ZSH 作为我的 shell,所以命令是:

echo 'export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home"' >> ~/.zshrc

Now you're almost home.现在你快到家了。 Just make sure you have Homebrew and then run brew cask install netbeans .只要确保你有Homebrew ,然后运行brew cask install netbeans

That should enable you to install it without issue and will place it in your Applications folder.这应该使您能够毫无问题地安装它并将其放置在您的应用程序文件夹中。

I solved it by installing JDK15 and Apache Netbeans 12.2 (Only 12.2).我通过安装 JDK15 和 Apache Netbeans 12.2(仅 12.2)解决了这个问题。

It works well.它运作良好。

Same here, it is because Big Sur update have erased $JAVA_HOME.这里也一样,这是因为 Big Sur 更新删除了 $JAVA_HOME。 echo $JAVA_HOME is empty and you cannot redirect to.bash_profile. echo $JAVA_HOME 为空,您无法重定向到 .bash_profile。 Maybe Big Sur updates will fix this.也许 Big Sur 更新会解决这个问题。 I am waiting/searching for an answer myself.我自己正在等待/寻找答案。 Not about to downgrade to Catalina just yet还不打算降级到 Catalina

I resolved my problem like this and it worked out wonderfully:我这样解决了我的问题,结果非常好:

Issue:问题:
When I executed Netbeans through command line in verbose mode, I saw the following error ./netbeans -v当我通过命令行以详细模式执行 Netbeans 时,我看到以下错误./netbeans -v
The operation couldn't be completed.操作无法完成。 Unable to locate a Java Runtime that supports (null).找不到支持 (null) 的 Java 运行时。 Please visit http://www.java.com for information on installing Java.请访问http://www.java.com了解有关安装 ZD52387880E1EA28118Z2133 的信息。

Solution:解决方案:
Edit netbeans.conf file编辑 netbeans.conf 文件
vi /Applications/NetBeans/NetBeans\ 8.2.app/Contents/Resources/NetBeans/etc/netbeans.conf vi /Applications/NetBeans/NetBeans\ 8.2.app/Contents/Resources/NetBeans/etc/netbeans.conf
Look for netbeans_jdkhome variable, uncomment it and substitute it appropriately.查找 netbeans_jdkhome 变量,取消注释并适当地替换它。 In my case the setting was:在我的情况下,设置是:
netbeans_jdkhome="/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home" netbeans_jdkhome="/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home"

Once you have done that, you can start Netbeans normally using the Netbeans shortcut or by using the command line.完成此操作后,您可以使用 Netbeans 快捷方式或使用命令行正常启动 Netbeans。

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

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