James Allman
James Allman

Reputation: 41188

Ant target 1.6 package not found

I am trying to down-compile a project for compatibility with Java 1.6 using Ant and I am receiving the error package javax.net.ssl does not exist.

<path id="master-classpath">
    <fileset dir="${lib}">
        <include name="*.jar"/>
    </fileset>
</path>

<javac source="1.6" target="1.6" 
 bootclasspath="/usr/lib/jvm/jdk1.6.0_45/jre/lib/rt.jar" 
 srcdir="${src}" destdir="${dest}" classpathref="master-classpath"/>

I can compile to Java 1.7 without any issue.

Do I need to declare a classpath to JDK1.6 in order to resolve the Java libraries?

Upvotes: 2

Views: 931

Answers (1)

James Allman
James Allman

Reputation: 41188

The java extensions (jsse.jar) must be appended to the bootclasspath. This wasn't obvious from the cross compilation example.

The corrected javac task is:

<javac source="1.6" target="1.6" 
       bootclasspath="/usr/lib/jvm/jdk1.6.0_45/jre/lib/rt.jar;/usr/lib/jvm/jdk1.6.0_45/jre/lib/jsse.jar" 
       srcdir="${src}" destdir="${dest}" classpathref="master-classpath"/>

Upvotes: 3

Related Questions