Ant javac 任务出错:[javac] 警告:[options] 引导类路径未与 -source 1.6 一起设置 [英] Ant javac task errs out: [javac] warning: [options] bootstrap class path not set in conjunction with -source 1.6

查看:98
本文介绍了Ant javac 任务出错:[javac] 警告:[options] 引导类路径未与 -source 1.6 一起设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试运行一个 ant 任务,它使用 axis2-ant-plugin-1.6.0.jarorgapacheaxis2 oolantAntCodegenTask 来执行 WSDL2Java 操作.

I'm trying to run an ant task that uses axis2-ant-plugin-1.6.0.jarorgapacheaxis2 oolantAntCodegenTask to perform a WSDL2Java operation.

在ant脚本的顶部,我定义了java6.boot.classpath:

At the top of the ant script, I define java6.boot.classpath:

    <property name="java6.boot.classpath" value="${env.JAVA6_BOOT_CLASSES}"/>

并且我将 JAVA6_BOOT_CLASSES 环境变量设置为 C:devjava64-bitjdk-1.6.0_45in.

And I have the JAVA6_BOOT_CLASSES environment variable set to C:devjava64-bitjdk-1.6.0_45in.

相关的蚂蚁目标如下:

<!-- dist.jar target -->
<target name="dist.jar" depends="generate"
    description="Creates the web services client jar file">
    <echo>Compiling web services client code</echo>

    <javac srcdir="${project.javapath}" destdir="${build}" 
           source="1.6" target="1.6" 
           debug="true" debuglevel="lines,vars,source" 
           excludes="com/company/junit/**"
           bootclasspath="${java6.boot.classpath}"
           includeantruntime="false">

        <classpath refid="compile.classpath" />
    </javac>

    <echo>Creating ${jarname}.jar</echo>
    <jar destfile="${dist}/${jarname}.jar" basedir="${build}" />
    <echo>${jarname}.jar created</echo>
</target>

尝试运行它,但是,我收到了标题错误:

Trying to run that, however, I receive the titular error:

 [javac] warning: [options] bootstrap class path not set in conjunction with -source 1.6  

有什么想法吗?我觉得我已经为 Java 1.6 适当地设置了引导类路径,但 ant 似乎不同意.

Any ideas? I feel like I've appropriately set the boot classpath for Java 1.6, but ant doesn't seem to agree.

推荐答案

这不是 Ant 而是 JDK 的 javac 发出警告.

This is not Ant but the JDK's javac emitting the warning.

如果你使用 Java 7 的 javac 和 -source 小于 7 javac 警告你你还应该设置引导类路径指向旧的 rt.jar - 因为这是确保结果在较旧的虚拟机.

If you use Java 7's javac and -source for anything smaller than 7 javac warns you you should also set the bootstrap classpath to point to an older rt.jar - because this is the only way to ensure the result is usable on an older VM.

https://blogs.oracle.com/darcy/entry/bootclasspath_older_source

这只是一个警告,所以你可以忽略它甚至用

This is only a warning, so you could ignore it and even suppress it with

<compilerarg value="-Xlint:-options"/>

或者你真的安装了一个旧的 JVM 并相应地调整你的引导类路径(你需要包含 rt.jar,而不是 bin 文件夹)

Alternatively you really install an older JVM and adapt your bootclasspath accordingly (you need to include rt.jar, not the bin folder)

这篇关于Ant javac 任务出错:[javac] 警告:[options] 引导类路径未与 -source 1.6 一起设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆