java 除了命令行,我还可以在哪里设置用于运行 Netbeans 的 JRE/JDK?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/504087/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-29 12:40:43  来源:igfitidea点击:

Where can I set the JRE/JDK which is used to run Netbeans besides the command line?

javanetbeansnetbeans6.5

提问by Daniel Rikowski

First of all, I know about the command line parameter, but I don't want to use it because I want to learn, not just get it done, so...

首先,我知道命令行参数,但我不想使用它,因为我想学习,而不仅仅是完成它,所以......

Where can I set the JRE/JDK which is used to run Netbeans?

我在哪里可以设置用于运行 Netbeans 的 JRE/JDK?

A little background:

一点背景:

  1. I installed JDK 1.6_10 (The system is Windows Vista Business 64)
  2. I installed Netbeans 6.5
  3. After a few weeks I uninstalled Netbeans 6.5 (some problems which I hope to solve by a reinstall)
  4. I also uninstalled JDK 1.6_10 and installed 1.6_11 instead.
  5. I reinstalled Netbeans 6.5
  6. Now I cannot start Netbeans because it insists of using the old JDK. (Trying to use the default version doesn't work either. JAVA_HOME is set to 1.6_11)
  1. 我安装了JDK 1.6_10(系统是Windows Vista Business 64)
  2. 我安装了 Netbeans 6.5
  3. 几周后我卸载了 Netbeans 6.5(我希望通过重新安装来解决一些问题)
  4. 我还卸载了 JDK 1.6_10 并安装了 1.6_11。
  5. 我重新安装了 Netbeans 6.5
  6. 现在我无法启动 Netbeans,因为它坚持使用旧的 JDK。(尝试使用默认版本也不起作用。JAVA_HOME 设置为 1.6_11)

回答by Michael Myers

Try setting netbeans_jdkhome in {NetBeans directory}/etc/netbeans.conf.

尝试在 {NetBeans 目录}/etc/netbeans.conf 中设置 netbeans_jdkhome。

# Default location of JDK, can be overridden by using --jdkhome : netbeans_jdkhome="..." # (omitted path, as I have Java in a non-standard location)

# JDK 的默认位置,可以使用 --jdkhome 覆盖:netbeans_jdkhome="..." # (省略路径,因为我在非标准位置安装了 Java)

回答by jourzero

Based on the voted answer, here's what I did on my Mac and it worked...

根据投票的答案,这是我在 Mac 上所做的,并且有效......

(download JDK from Oracle)
$ vi /Applications/NetBeans/NetBeans\ 8.2.app/Contents/Resources/NetBeans/etc/netbeans.conf
[...]
#netbeans_jdkhome="/Applications/NetBeans/NetBeans 8.2.app/Contents/Resources/NetBeans/bin/jre"
netbeans_jdkhome="/Library/Java/JavaVirtualMachines/jdk1.8.0_112.jdk/Contents/Home/"