[英]How can I set the default Java platform in NetBeans 8.2?
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 the default Java Platform.唯一的问题是我想将此平台设置为 1.7(而不是当前的 1.8),但 NetBeans 8.2 需要在 1.8 上运行,所以我不能将 1.7 作为默认 Java 平台。
Is there a way to override it?有没有办法覆盖它?
You can get your default JDK by: Tools - Java Plattforms . 您可以通过以下方式获取默认JDK: Tools - Java Plattforms 。 There you can add all your JDKs and watch their bibs.
在那里,您可以添加所有JDK并观看他们的围兜。 If you want to change the default one you need to go the path: C:\\Program Files\\NetBeans 8.2\\etc and you need to change the netbeans.conf
如果要更改默认路径,则需要转到路径: 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并完成。
For now, it appears there is no way to override it, here is NetBeans Help about Java Platform Manager: 目前,似乎没有办法覆盖它,这里是关于Java Platform Manager的NetBeans帮助:
Use to register different versions of the Java Development Kit (JDK) and other Java tools that your programs depend on.
用于注册不同版本的Java Development Kit(JDK)和程序所依赖的其他Java工具。 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.
该对话框在左窗格中列出了所有已注册的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 plugin that allows to right-click maven projects to set the JDK (still cannot set it by default). 有一个最近的插件允许右键单击maven项目来设置JDK(默认情况下仍然无法设置)。
There is no eclipse like default option. 没有像默认选项那样的eclipse。 You can set java platform for every imported project.
您可以为每个导入的项目设置java平台。 Change JRE in NetBeans project
在NetBeans项目中更改JRE
Here is how to set and change default JDK in NetBeans for Mac OS X users (tested with NetBeans IDE 12.5, should work with several other versions):以下是在 NetBeans 中为 Mac OS X 用户设置和更改默认 JDK 的方法(使用 NetBeans IDE 12.5 测试,应该适用于其他几个版本):
/Applications/NetBeans/Apache NetBeans 12.5.app/Contents/Resources/NetBeans/netbeans/etc/netbeans.conf
)/Applications/NetBeans/Apache NetBeans 12.5.app/Contents/Resources/NetBeans/netbeans/etc/netbeans.conf
)#netbeans_jdkhome="path/to/jdk"
#netbeans_jdkhome="path/to/jdk"
netbeans_jdkhome="path/to/jdk"
netbeans_jdkhome="path/to/jdk"
/Library/Java/JavaVirtualMachines/jdk1.8.0_301.jdk/Contents/Home
/Library/Java/JavaVirtualMachines/jdk1.8.0_301.jdk/Contents/Home
netbeans_jdkhome="/Library/Java/JavaVirtualMachines/jdk1.8.0_301.jdk/Contents/Home"
netbeans_jdkhome="/Library/Java/JavaVirtualMachines/jdk1.8.0_301.jdk/Contents/Home"
Hope this helped the mac users.希望这对mac用户有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.