如何在 netbeans 8.2 中设置默认 Java 平台
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/40909025/
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
How to set default java platform in netbeans 8.2
提问by Groben
So I want to set the default Java Platform which is used to build my projects in Netbeans 8.2 (netbeans_jdkhome).
所以我想设置用于在 Netbeans 8.2 (netbeans_jdkhome) 中构建我的项目的默认 Java 平台。
Prior versions allowed me to do that see this answer.
以前的版本允许我这样做,请参阅此答案。
The only problem is that I want to set this platform to be 1.7 (instead of current 1.8) but Netbeans 8.2 requires to run on 1.8 so I cannot have 1.7 as default Java Platform.
唯一的问题是我想将此平台设置为 1.7(而不是当前的 1.8),但 Netbeans 8.2 需要在 1.8 上运行,所以我不能将 1.7 作为默认 Java 平台。
Is there any way to override it ?
有什么办法可以覆盖它吗?
EDIT:
编辑:
PLEASE DO NOT UPVOTE LenglBoy ANSWER AS IT WAS EXACTLY WHAT I WAS NOT LOOKING FOR
请不要为 LenglBoy 的回答点赞,因为这正是我想要的
His answer was in the link that I posted, he didn't even read my question. If anyone has a solution that works with latests versions of Netbeans, please post it.
他的回答在我发布的链接中,他甚至没有阅读我的问题。如果有人有适用于最新版本的 Netbeans 的解决方案,请发布。
采纳答案by Groben
For now, it appears there is no way to override it, here is NetBeans Help about Java Platform Manager:
目前,似乎没有办法覆盖它,这里是关于 Java 平台管理器的 NetBeans 帮助:
Use to register different versions of the Java Development Kit (JDK) and other Java tools that your programs depend on. The dialog box lists all of your registered JDKs in the left pane and lists the JDK that the IDE is running on as the Default Platform.
用于注册不同版本的 Java 开发工具包 (JDK) 和您的程序所依赖的其他 Java 工具。该对话框在左侧窗格中列出了所有已注册的 JDK,并列出了运行 IDE 作为默认平台的 JDK。
So I'll have to change platform for each project because Netbeans 8.2 can not run with JDK 1.7 (so I can't set it as default platform).
因此,我必须为每个项目更改平台,因为 Netbeans 8.2 无法与 JDK 1.7 一起运行(因此我无法将其设置为默认平台)。
LenglBoy didn't even read my question, the same thing was done in the link I posted.
LenglBoy 甚至没有阅读我的问题,我发布的链接中也做了同样的事情。
There is a recent pluginthat allows to right-click maven projects to set the JDK (still cannot set it by default).
回答by LenglBoy
You can get your default JDK by: Tools - Java Plattforms. There you can add all your JDKs and watch their bibs. If you want to change the default one you need to go the path: C:\Program Files\NetBeans 8.2\etcand you need to change the netbeans.conf
您可以通过以下方式获取默认 JDK:工具 - Java 平台。在那里,您可以添加所有 JDK 并查看它们的参考资料。如果要更改默认设置,则需要转到路径:C:\Program Files\NetBeans 8.2\etc并且需要更改netbeans.conf
In line 57 (in mine) you see something like this:
在第 57 行(在我的)中,您会看到如下内容:
netbeans_jdkhome="C:\Program Files\Java\jdk1.8.0_66"
Change the Path to your wanted JDK and you′re finish.
将路径更改为您想要的 JDK,您就完成了。
Herea longer description.
这里有一个更长的描述。
回答by Jovo Skorupan
There is no eclipse like default option. You can set java platform for every imported project. Change JRE in NetBeans project
没有像默认选项那样的日食。您可以为每个导入的项目设置 java 平台。 在 NetBeans 项目中更改 JRE