RTC3 Build engine and Ant - How to maintain two different builds for different Java versions
Hi. We are in the process of upgrading our application to run on WAS7 and Java 1.6 from WAS6.1, Java 1.5. Until we actually upgrade in production we have to maintain builds for both versions to different environments.
We have one build engine running on one of our servers(zlinux), and a variable given at the ANT command line indicates the target environment. The current default classpath variables on the server point to Java 1.5 installations. I've been trying to override those in a special build definition for WAS7/1.6 and I'm getting some compilation errors.
In the build definition:
Ant tab-Java Home:/usr/lib64/jvm/java-1.6.0
In the ant build.xml
<javac destdir="${classes.dir}" debug="true"
deprecation="false" optimize="false" failonerror="true" " executable="/usr/lib64/jvm/java-1.6.0/bin/javac" compiler="javac1.6">
<src path="${src.dir}"/>
<classpath refid="classpath"/>
</javac>
During compilation I get this error:
[javac] /gsa/pokgsa-p2/01/wwprt-3.0/.aheweb01/projects/w3dev2/tmp/finance/tools/wwprt/fetched3/WwprtBackend/src/com/ibm/etools/xmlschema/beans/Factory.java:43: cannot access java.util.Hashtable
[javac] bad class file: /usr/lib64/jvm/java-1.6.0-ibm-1.6.0/jre/lib/java.util.jar(java/util/Hashtable.class)
[javac] class file has wrong version 50.0, should be 49.0
[javac] Please remove or make sure it appears in the correct subdirectory of the classpath.
[javac] protected Hashtable importedFileHashtable = new Hashtable();
The error tells me that it is looking for a Java 1.5 version of java.util.Hastable and not the Java 1.6 version. Is there somewhere that I'm missing that I need to point to Java 1.6?
Any help would be appreciated!
We have one build engine running on one of our servers(zlinux), and a variable given at the ANT command line indicates the target environment. The current default classpath variables on the server point to Java 1.5 installations. I've been trying to override those in a special build definition for WAS7/1.6 and I'm getting some compilation errors.
In the build definition:
Ant tab-Java Home:/usr/lib64/jvm/java-1.6.0
In the ant build.xml
<javac destdir="${classes.dir}" debug="true"
deprecation="false" optimize="false" failonerror="true" " executable="/usr/lib64/jvm/java-1.6.0/bin/javac" compiler="javac1.6">
<src path="${src.dir}"/>
<classpath refid="classpath"/>
</javac>
During compilation I get this error:
[javac] /gsa/pokgsa-p2/01/wwprt-3.0/.aheweb01/projects/w3dev2/tmp/finance/tools/wwprt/fetched3/WwprtBackend/src/com/ibm/etools/xmlschema/beans/Factory.java:43: cannot access java.util.Hashtable
[javac] bad class file: /usr/lib64/jvm/java-1.6.0-ibm-1.6.0/jre/lib/java.util.jar(java/util/Hashtable.class)
[javac] class file has wrong version 50.0, should be 49.0
[javac] Please remove or make sure it appears in the correct subdirectory of the classpath.
[javac] protected Hashtable importedFileHashtable = new Hashtable();
The error tells me that it is looking for a Java 1.5 version of java.util.Hastable and not the Java 1.6 version. Is there somewhere that I'm missing that I need to point to Java 1.6?
Any help would be appreciated!
One answer
Not specifically answering this issue but wanted to offer some advice that we found on our upgrade path of WAS6.1 to WAS7. Before moving code to WAS7 we rebuilt it using a 1.6 jdk, but with the 1.5 source/target flags set in a compatibility mode. This allowed us to get the same jar to run find in either environment. Then teams could remove the compatibility mode as needed to go from 1.5 compatibility mode to 1.6.