更改运行 netbeans 的 Java 平台
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2809366/
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
Changing java platform on which netbeans runs
提问by rgksugan
I am using Netbeans 6.7. I had first installed Java 1.5 before installing Netbeans. When i installed Netbeans it took Java 1.5 as the default version. Then i installed Java 1.6 on my machine. I need to change the default JDK of my netbeans to 1.6 not only to a specific project but to the whole Netbeans application.
我正在使用 Netbeans 6.7。在安装 Netbeans 之前,我首先安装了 Java 1.5。当我安装 Netbeans 时,它采用 Java 1.5 作为默认版本。然后我在我的机器上安装了 Java 1.6。我需要将我的 netbeans 的默认 JDK 更改为 1.6,不仅适用于特定项目,而且适用于整个 Netbeans 应用程序。
采纳答案by Abdel Raoof
You can change the JDK for Netbeans by modifying the config file:
您可以通过修改配置文件来更改 Netbeans 的 JDK:
- Open
netbeans.conf
file available underetc
folder inside the NetBeans installation. - Modify the
netbeans_jdkhome
variable to point to new JDK path, and then - Restart your Netbeans.
- 打开NetBeans 安装文件夹
netbeans.conf
下的可用etc
文件。 - 修改
netbeans_jdkhome
变量指向新的JDK路径,然后 - 重新启动您的 Netbeans。
回答by Mohamad Alhamoud
open etc folder in netbeans folder then edit the netbeans.conf with notepad and you will find a line like this :
在 netbeans 文件夹中打开 etc 文件夹,然后用记事本编辑 netbeans.conf,你会发现这样一行:
Default location of JDK, can be overridden by using --jdkhome :
netbeans_jdkhome="G:\Program Files\Java\jdk1.6.0_13"
JDK 的默认位置,可以使用 --jdkhome 覆盖:
netbeans_jdkhome="G:\Program Files\Java\jdk1.6.0_13"
here you can set your jdk version.
在这里你可以设置你的jdk版本。
回答by shousper
For anyone on Mac OS X, you can find netbeans.conf
here:
对于 Mac OS X 上的任何人,您可以在netbeans.conf
这里找到:
/Applications/NetBeans/NetBeans <version>.app/Contents/Resources/NetBeans/etc/netbeans.conf
In case anyone needs to know :)
如果有人需要知道:)
回答by Paulo Carvalho
In my Windows 7 box I found netbeans.confin <Drive>:\<Program Files folder>\<NetBeans installation folder>\etc
. Thanks all.
在我的Windows 7盒,我发现的netbeans.conf在<Drive>:\<Program Files folder>\<NetBeans installation folder>\etc
。谢谢大家。
回答by dotbit
on Fedora it is currently impossible to set a new jdk-HOME to some sdk. They designed it such that it will always break. Try --jdkhome [whatever] but in all likelihood it will break and show some cryptic nonsensical error message as usual.
在 Fedora 上,目前无法为某些 sdk 设置新的 jdk-HOME。他们将它设计成它总是会破裂。尝试 --jdkhome [whatever] 但它很可能会像往常一样中断并显示一些神秘的无意义错误消息。