简体   繁体   English

在Mac OSX 10.7.5上的Netbeans中编译Java 1.5 Web应用程序

[英]Compile Java 1.5 web app in Netbeans on Mac OSX 10.7.5

I am running Netbeans on my Mac OSX 10.7.5 which uses Java 1.6. 我在使用Java 1.6的Mac OSX 10.7.5上运行Netbeans。 I need to compile my web app in Netbeans against Java 1.5. 我需要针对Java 1.5在Netbeans中编译我的Web应用程序。 I tried to install Java 1.5 on my Mac OSX, but it will not let you. 我试图在Mac OSX上安装Java 1.5,但不允许您这样做。 How can I compile my netbeans web app against Java 1.5 on my mac osx? 如何在Mac OS X上针对Java 1.5编译netbeans Web应用程序?

Go to Tools -> Java Platforms . 转到工具 -> Java平台 There, click on Add Platform , point it to YOUR_JDK_LOCATION . 在此处,单击添加平台 ,将其指向YOUR_JDK_LOCATION You can either set the another JDK version or remove existing versions. 您可以设置另一个JDK版本或删除现有版本。

after adding multiple platform change your project compile specification according to your requirement 添加多个平台后,根据需要更改项目编译规范

To download jdk binary please visit below location 要下载JDK二进制文件,请访问以下位置

Link 1 zip file 链接1个zip文件

Link 2 tar file 链接2 tar文件

change your java version 更改您的Java版本

$ export JAVA_HOME= /usr/libexec/java_home -v '1.5*'` $ export JAVA_HOME= / usr / libexec / java_home -v'1.5 *'`

OR 要么

parameterize the compiler like javac -source 1.5 -target 1.5 javac -source 1.5 -target 1.5一样对编译器进行参数化

I believe I figured it out. 我相信我知道了。 In Netbeans, if you right click your project and go to 'Properties', in the 'Sources' category there is an option that says 'Source/Binary Format' which contains a drop down list where you can select the JDK version to build your project. 在Netbeans中,如果右键单击您的项目并转到“属性”,则在“源”类别中有一个选项为“源/二进制格式”,其中包含一个下拉列表,您可以在其中选择JDK版本来构建您的项目。

Since I am running JDK 6 on my mac, it will allow you to select version 6 and below, and in my case, I select version 5. 由于我在Mac上运行JDK 6,因此它将允许您选择版本6和更低版本,就我而言,我选择版本5。

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

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