Uko*_*Uko 21 netbeans javac java-7
我正在进入Java7开发,我已经将JDK7添加到Java平台中,并在项目属性中选择了它.
但是当我编译时,我得到的信息如下:
warning: java/lang/Boolean.class(java/lang:Boolean.class): major version 51 is newer than 50, the highest major version supported by this compiler.
It is recommended that the compiler be upgraded.
Run Code Online (Sandbox Code Playgroud)
和
javac: invalid target release: 1.7
/Applications/NetBeans/NetBeans 7.1.app/Contents/Resources/NetBeans/harness/suite.xml:184: The following error occurred while executing this line:
/Applications/NetBeans/NetBeans 7.1.app/Contents/Resources/NetBeans/harness/common.xml:206: Compile failed; see the compiler error output for details.
Run Code Online (Sandbox Code Playgroud)
据我所知,Netbeans正在使用javac 1.6.如何更改为1.7?
我正在编写一个NetBeans平台应用程序,并在我设置的主应用程序属性中:Java Platform = JDK 1.7.在其中一个模块的属性中,我设置了Source level = 1.7.
suite.xml(184是这里的第二行)
<target name="build" depends="-init,branding,release,-hide-excluded-modules" description="Build all modules in the suite.">
<subant target="netbeans" buildpath="${modules.sorted}" inheritrefs="false" inheritall="false">
<property name="cluster.path.evaluated" value="${cluster.path.evaluated}"/> <!-- Just for speed of pre-7.0 projects -->
</subant>
</target>
Run Code Online (Sandbox Code Playgroud)
common.xml(206是这里的第二行)
<nb-javac srcdir="${src.dir}" destdir="${build.classes.dir}" debug="${build.compiler.debug}" debuglevel="${build.compiler.debuglevel}" encoding="UTF-8"
deprecation="${build.compiler.deprecation}" optimize="${build.compiler.optimize}" source="${javac.source}" target="${javac.target}" includeantruntime="false">
<classpath refid="cp"/>
<compilerarg line="${javac.compilerargs}"/>
<processorpath refid="processor.cp"/>
</nb-javac>
Run Code Online (Sandbox Code Playgroud)
ala*_*inm 28
右键单击您的项目 - >项目属性
然后在Sources设置Source/Binary Format为JDK 7.
编辑1:
存在NetBeans问题:
在J2SE项目中工作正常,Web项目特定问题.问题是fork ="false"将JDK 7.0参数传递给JDK 6.0编译器.可执行文件需要fork ="true".
在build-iml.xml的第293行
<javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}"
encoding="${source.encoding}" excludes="@{excludes}"
executable="${platform.javac}" fork="${javac.fork}" includeantruntime="false"
includes="@{includes}" source="${javac.source}" srcdir="@{srcdir}"
target="${javac.target}" tempdir="${java.io.tmpdir}">
Run Code Online (Sandbox Code Playgroud)
应成为:
<javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}"
encoding="${source.encoding}" excludes="@{excludes}"
executable="${platform.javac}" fork="yes" includeantruntime="false"
includes="@{includes}" source="${javac.source}" srcdir="@{srcdir}"
target="${javac.target}" tempdir="${java.io.tmpdir}">
Run Code Online (Sandbox Code Playgroud)
编辑2(如果第一个提示不起作用):
尝试在JDK7中运行Netbeans IDE.
编辑Netbeans conf文件:
Linux
〜/的.netbeans/7.0的/ etc/app.conf
Mac Os X
/ Applications/NetBeans/NetBeans\7.1.app/Contents/Resources/NetBeans/harness/etc/app.conf
在行中添加jdk7路径jdkhome=.
要么
使用以下方式启动netbeans:
netbeans --jdkhome/Java7/Home/dir
| 归档时间: |
|
| 查看次数: |
51541 次 |
| 最近记录: |