I'm trying to run an ant task that uses axis2-ant-plugin-1.6.0.jar\\org\\apache\\axis2\\tool\\ant\\AntCodegenTask
to perform a WSDL2Java
operation.
At the top of the ant script, I define java6.boot.classpath
:
<property name="java6.boot.classpath" value="${env.JAVA6_BOOT_CLASSES}"/>
And I have the JAVA6_BOOT_CLASSES
environment variable set to C:\\dev\\java\\64-bit\\jdk-1.6.0_45\\bin
.
The pertinent ant target is as follows:
<!-- 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
Any ideas? I feel like I've appropriately set the boot classpath for Java 1.6, but ant doesn't seem to agree.
This is not Ant but the JDK's javac emitting the warning.
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"/>
Alternatively you really install an older JVM and adapt your bootclasspath accordingly (you need to include rt.jar
, not the bin
folder)
In the ant build.xml
file create a property which will point to Java 6 rt.jar
<path id="boot.classpath" location="C:/Program Files (x86)/Java/jre6/lib/rt.jar" />
and refer to it in the javac
task:
<javac srcdir="${src}" bootclasspathref="boot.classpath" classpathref="classpath" includeantruntime="false" destdir="${build}" source="1.6" target="1.6" />
You may also directly specify the bootclasspath in javac
task using bootclasspath
attribute
And I have the JAVA6_BOOT_CLASSES environment variable set to C:\\dev\\java\\64-bit\\jdk-1.6.0_45\\bin.
This is the problem. Set the bootclasspath to point to the directory that contains the rt.jar. It should be like: C:\\dev\\java\\64-bit\\jdk-1.6.0_45\\jre\\lib
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.