Java Mailing List Archive

http://www.ant-tasks.com/

Apache Ant Archive

» Ant Users List
» Ant Developers List
Javac version

Javac version

2005-06-14       - By Darin Swanson
Reply:     1     2     3  

Which Eclipse?

I would make an educated guess that you are running Eclipse with 1.4.2 but
you are doing your build with 1.3.* or have a 1.3.* tools.jar on your Ant
runtime classpath?
Check the JRE tab and the classpath tab for your Ant launch configuration
that is failing.

HTH
Darins

Note: in the future it is likely better to ask Eclipse questions in an
Eclipse forum...such as the Eclipse newsgroups.




"Payette, Don J" <Don.Payette@(protected)>
06/14/2005 09:02 AM
Please respond to
"Ant Users List"


To
"Ant Users List" <user@(protected)>
cc

Subject
Javac version






I have a project setup in Eclipse and am using ant to do my builds
from within Eclipse.  Things have been working fine, until I tried
to move from Java 1.3.1 to Java 1.4.2.  I get the following output from
ant.



Buildfile: C:\SPEC\build.xml

load-corp:

compile:
       [echo] The classpath for compilation is
c:\Java\j2sdkee1.4.2_07\lib\j2ee.jar:jars/xerces.jar:jars/MCP.jar
       [echo] Java home is C:\Java\j2sdk1.4.2_07
      [javac] Compiling 307 source files to C:\SPEC\classes
      [javac] C:\SPEC\src\com\sun\jini\debug\Debug.java:177: cannot
access java.lang.Object
      [javac] bad class file:
C:\Java\j2sdk1.4.2_07\jre\lib\rt.jar(java/lang/Object.class)
      [javac] class file has wrong version 48.0, should be 47.0
      [javac] Please remove or make sure it appears in the correct
subdirectory of the classpath.
      [javac]     private String propertyName;
      [javac]             ^
      [javac] 1 error
      [javac] BUILD FAILED: file:C:/SPEC/build.xml:110: Compile failed;
see the compiler error output for details.
Total time: 5 seconds
------------------------------------------------------------------------
-----------
end ant output
------------------------------------------------------------------------
-----------

The shortcut I use to run eclipse points to 1.4.2 as the vm, ala:
C:\eclipse\V2_1_3\eclipse\eclipse.exe eclipse -vm
C:\Java\j2sdk1.4.2_07\bin\javaw.exe

Following find all the relevant files.  Any ideas what is going on?

Don Payette
Unisys Corporation

------------------------------------------------------------------------
-----------
build.xml
<?xml version="1.0"?>

<!--  SPECjAppServer build definitions.

 August 2002 : Modified default to use CMP

 April 2002 : Modified for SPECjAppServer 2001

 April 2001 : Minor Modifications by Tom Daly (Sun)

 March 2001 : Thanks to Bill Kayser (Alliare) for creating the initial
version of this
              ant input file and for the documentation accompanying it
which has been
              incorporated into the README.html

 Please refer to the readme.html for instructions on building and
deploying
 the SPECjAppServer source.

 This file contains targets for compiling and packaging war files and
 ejb files using ant 1.3 or later.

 You can find the ant binaries at http://jakarta.apache.org/ant

 It should not be necessary to edit this file.

 EXECUTING TARGETS

 To execute a target for a particular appserver such as the reference
 implementation, do this:

 ant -Dappserver=ri.1.3.1 target

 Substitute "ri.1.3.1" for the name of the appserver, such as "tomcat"
or
 "jrun".

 "ant" should be invoked from the SPECjAppServer top directory
($JAS_HOME)

 SUPPORTED TARGETS

 These are the targets you are most likely to use:

 clean:              Delete all output files
 jAppServer-ear:     Builds all ejb jar files and warfiles needed for
                     SPECjAppServer, minus the supplier, emulator and
driver.
 emulator-ear:       Builds the emulator ear file with the war inside.
 allejbs:                Builds just the ejb jar files for all
deployable ejbs
 clean-driver:       Removes the driver class files and jar in
preparation for
                         rebuilding.
 driver:                 Builds the driver.jar file, this must be
called explicitly
                         as it is not part of the default build also
driver.jar is not
                         removed by the "clean" target
 load:                   builds the load.jar file
 loaddb:             Executes the load program for all domains.
 load-corp,load-supp,load-mfg,load-ords,load-rules:
                 The targets for individual domain db loading

 -->

<project name="SPECjAppServer" default="all">

 <!-- This property determines where env and config files will
      be loaded from.  The default is "ri.1.3.1" which means that
      config/ri.1.3.1.env will be loaded and the EJB descriptors will
      be found in src/deploy/ri.1.3.1.  -->

 <property name="appserver" value="ri.1.3.1"/>

 <!-- This is the classpath used for compilation.
      If you don't have the j2ee.jar file handy, you
      can substitute it with the individual ext jar
      files if you have them instead.  -->


 <!-- Load the external properties.
      These will override any settings here. -->
 <property file="config/${appserver}.env"/>

  <property name="compile.classpath"
           value="${JAVAX_JAR}:jars/xerces.jar:jars/MCP.jar"/>

 <!-- This uses the JDK1.3 compiler if available.  You may need to set
JAVA_HOME. -->
   <property name="build.compiler" value="modern"/>

   <property name="descriptor-dir" location="src/deploy/${appserver}"/>

   <target name="all" depends="jAppServer-ear,emulator-ear,load"/>

   <!-- Delete all the targets -->
   <target name="clean">
       <delete dir="./classes/WEB-INF" />
       <mkdir dir="./classes/WEB-INF" />
       <delete>
         <fileset dir="."
             includes="**/*~,**/*.class,*.zip,**/*.?ar"
excludes="ant/lib/*.jar,jars/*chart*.jar,jars/driver.jar,

,jars/launcher.jar,jars/xerces.jar,jars/MCP.jar"/>
       </delete>
  </target>

   <!-- Compile everything -->
   <target name="compile">
   <echo message="The classpath for compilation is
${compile.classpath}" />
   <echo message="Java home is ${JAVA_HOME}" />
   <javac srcdir="src"
          deprecation="on"
                   debug="on"
                   destdir="classes"
                   includes="**/*.java"
                   excludes="**/charts*/*"
                   target="1.2"
                   classpath="${compile.classpath}"/>
   </target>


   <!-- DRIVER clean and REBUILD Targets
        It is not expected that the driver will need to be deleted or
rebuilt
        but the next 2 targets provide for this should the user
explicitly want
        to do it. So be aware that the "clean" target will not effect
the
        driver classes or jar, you must use "ant clean-driver" to
remove driver files
        and then "ant driver" to build the new driver

        The driver target also rebuilds the launcher.jar file which
contains the
        logic to initiate the driver in a portable fashion.
   -->

   <target name="clean-driver" >
       <delete>
           <fileset dir="." includes="**/driver/*.class,
**/jars/driver.jar,
**/jars/launcher.jar" />
       </delete>
   </target>

   <target name="driver" depends="compile">
   <rmic base="./classes"
includes="**/driver/*Impl.class,**/driver/*Agent.class"
excludes="**/driver/Agent.class" />
   <jar jarfile="jars/driver.jar" compress="false">
       <fileset dir="classes"
              includes="**/driver/*.class"/>
   </jar>
   <jar jarfile="jars/launcher.jar" compress="false">
       <fileset dir="classes"
              includes="**/launcher/*.class"/>
   </jar></target>


 <!-- Definitions for the names of the descriptor files -->

 <property name="dd.persistence" value="BMP"/>
 <property name="dd.supp" value="supplier.xml.${dd.persistence}"/>
 <property name="dd.servlet" value="servlet.xml"/>
 <property name="dd.web" value="web.xml"/>
 <property name="dd.application" value="application.xml"/>
 <property name="dd.emu-web" value="emulator-web.xml"/>
 <property name="dd.emu-app" value="emulator-app.xml"/>

 <property name="dd.application-specific" value="sun-j2ee-ri.xml"/>
 <property name="tmpdir" value="./tmpdir"/>

 <!-- EJB Jar Packaging  -->

 <target name="allejbs" depends="util,corp,orders,mfg,supplier-ejb"/>

 <target name="util" depends="compile">
   <jar jarfile="jars/util.jar" compress="false">
     <fileset dir="classes"
              includes="**/common/**,**/util/**"/>
     <zipfileset dir="${descriptor-dir}/util/${dd.persistence}"
                 includes="*.xml"
                 prefix="META-INF"/></jar></target>

 <target name="corp" depends="compile">
   <jar jarfile="jars/corp.jar" compress="false">
     <fileset dir="classes"
              includes="**/common/**,**/ruleengine/**,**/corp/**"/>
     <zipfileset dir="${descriptor-dir}/corp/${dd.persistence}"
                 includes="*.xml"
                 prefix="META-INF"/></jar></target>

 <target name="orders" depends="compile">
   <jar jarfile="jars/orders.jar" compress="false">
     <fileset dir="classes"
              includes="**/common/**,**/orders/**"/>
     <zipfileset dir="${descriptor-dir}/orders/${dd.persistence}"
                 includes="*.xml"
                 prefix="META-INF"/></jar></target>

 <target name="mfg" depends="compile">
   <jar jarfile="jars/mfg.jar" compress="false">
     <fileset dir="classes"
              includes="**/common/**,**/mfg/**"/>
     <zipfileset dir="${descriptor-dir}/mfg/${dd.persistence}"
                 includes="*.xml"
                 prefix="META-INF"/></jar></target>

 <!--
   The supplier needs to have the xerces xml parser classes
   so add xerces.jar in the classpath of the server
 -->

 <target name="supplier-ejb" depends="compile">
   <property name="tmpfile" value="tmp.xml"/>
   <antcall target="process-dd">
     <param name="source-dd" value="${descriptor-dir}/${dd.supp}"/>
     <param name="target-dd" value="${tmpfile}"/></antcall>

   <jar jarfile="jars/supplier.jar" compress="false">
     <fileset dir="classes"
              includes="**/common/**,**/supplier/**"
              excludes="**/supplier/helper/LogManager.class,
                        **/supplier/web/**,**/supplier/emulator/**"/>
     <zipfileset dir="."
                 includes="${tmpfile}"
                 fullpath="META-INF/ejb-jar.xml"/>
     <zipfileset dir="${descriptor-dir}/supplier/${dd.persistence}"
                 includes="*.xml"
                 prefix="META-INF"/></jar>
   <delete file="${tmpfile}"/></target>

 <!-- This is an ant subroutine.

      This routine should be called with the property source-dd set
      to the deployment descriptor which will be copied to the file
      given by target-dd with the emulator host and port tokens
      substituted.

      NOTE: This could be done automatically if the tokens
      fit ant token syntax: @(protected)@   Ant does automatic token
      substitution during <copy>   -->

 <target name="process-dd">
   <property name="tmpfile" location="classes/tmp.xml"/>
   <copy tofile="${target-dd}"
         overwrite="true"
         file="${source-dd}"/>
   <replace file="${target-dd}"
            token="EMULATOR_HOST"
                     value="${EMULATOR_HOST}"/>
   <replace file="${target-dd}"
            token="EMULATOR_PORT"
                     value="${EMULATOR_PORT}"/>
   <replace file="${target-dd}"
            token="_EMULATOR_PREFIX_"
                     value="${EMULATOR_PREFIX}"/>
   <replace file="${target-dd}"
            token="JAS_HOST"
                     value="${JAS_HOST}" />
   <replace file="${target-dd}"
            token="JAS_PORT"
                     value="${JAS_PORT}" />
   <replace file="${target-dd}"
            token="_JAS_PREFIX_"
                     value="${JAS_PREFIX}" /></target>

 <!-- Web application archive packaging.
      The web applications consist of the targets:

        supplier-war
        web-war
        emulator-war       -->

 <target name="supplier-war" depends="compile">
   <war warfile="jars/supplier.war" compress="false"
        webxml="${descriptor-dir}/${dd.servlet}"
        basedir="src/docroot" includes="dtd/**/*">
     <classes
        dir="classes"
        includes="**/common/**,**/supplier/helper/**,
                  **/supplier/web/**"/>
     <zipfileset dir="${descriptor-dir}/servlet"
                 includes="*.xml"
                 prefix="WEB-INF"/>
    </war>
 </target>

 <target name="web-war" depends="compile">
   <war warfile="jars/web.war" compress="false"
        webxml="${descriptor-dir}/${dd.web}"
                 basedir="src/docroot">
     <classes
        dir="classes"
        includes="**/common/**,**/webbeans/**"/>
     <zipfileset dir="${descriptor-dir}/web"
                 includes="*.xml"
                 prefix="WEB-INF"/>
   </war>
 </target>


 <!--
   The emulator needs to have the xerces xml parser classes
   so add xerces.jar in the classpath of the server
 -->
 <target name="emulator-war" depends="compile">

   <property name="tmpfile" location="classes/tmp.xml"/>
   <antcall target="process-dd">
     <param name="source-dd" value="${descriptor-dir}/${dd.emu-web}"/>
     <param name="target-dd" value="${tmpfile}"/></antcall>
   <war warfile="jars/emulator.war" compress="false"
        webxml="${tmpfile}"
                 basedir="src/docroot"
                 includes="dtd/**/*">
     <classes
        dir="classes"
        includes="**/common/**,**/supplier/emulator/**,
                  **/jini/**,**/supplier/helper/**"/>
   </war>
   <delete file="${tmpfile}"/></target>

 <!-- Convenience target for building the entire supplier -->
 <target name="supplier" depends="supplier-ejb,supplier-war"/>

 <!-- EAR Files -->
 <target name="jAppServer-ear"
depends="util,supplier,web-war,corp,orders,mfg">
   <mkdir dir="${tmpdir}" />
   <mkdir dir="${tmpdir}/META-INF"/>
   <copy todir="${tmpdir}/META-INF" >
                  <fileset dir="${descriptor-dir}"
                  includes="${dd.application},${dd.application-specific}"
/>
   </copy>
   <copy todir="${tmpdir}" >
       <fileset dir="jars"

includes="corp.jar,mfg.jar,orders.jar,supplier.jar,util.jar
                          supplier.war,web.war" />
   </copy>
   <jar jarfile="jars/SPECjAppServer.ear"  compress="false"
        basedir="${tmpdir}" >
   </jar>
   <delete dir="${tmpdir}" />
 </target>

 <target name="emulator-ear" depends="emulator-war">
   <zip zipfile="jars/emulator.ear" compress="false"
        basedir="jars"
                 includes="emulator.war">
     <zipfileset dir="${descriptor-dir}"
                 includes="${dd.emu-app}"
fullpath="META-INF/application.xml"/></zip>
 </target>

 <!-- DB Load -->

 <!-- Default scale value.  Should be overridden on the command line.
-->
 <property name="SCALE" value="1"/>

 <property name="JAS_HOME" location="."/>

 <target name="loaddb"

depends="load-corp"/><!--,load-supp,load-mfg,load-ords,load-rules"/-->
 <target name="load-corp">
   <antcall target="_loaddb">
     <param name="Domain" value="Corp"/></antcall></target>

 <target name="load-supp">
   <antcall target="_loaddb">
     <param name="Domain" value="Supp"/></antcall></target>

 <target name="load-mfg">
   <antcall target="_loaddb">
     <param name="Domain" value="Mfg"/></antcall></target>

 <target name="load-ords">
   <antcall target="_loaddb">
     <param name="Domain" value="Ords"/></antcall></target>

 <target name="load-rules">
   <property name="LoadPkg" value="org.spec.jappserver.load"/>
   <java classname="${LoadPkg}.LoadRules"
         fork="true">
     <classpath>
       <pathelement path="${JDBC_CLASSPATH}"/>
       <pathelement path="${CLASSPATH}"/>
                <pathelement location="jars/load.jar"/></classpath>
     <jvmarg value="-Dspecjappserver.home=${JAS_HOME}"/>
     <arg value="discount"/>
     <arg value="${JAS_HOME}/schema/discount.rules"/></java></target>

 <!-- Generic Ant target for loading a table.  Should
       be invoked using antcall action seting the Domain argument. -->

 <target name="_loaddb" depends="load">
   <property name="LoadPkg" value="org.spec.jappserver.load"/>
   <property name="Domain" value="Ords"/>
   <java classname="${LoadPkg}.Load${Domain}" fork="true">
     <jvmarg value="-Dspecjappserver.home=${JAS_HOME}"/>
     <arg value="${SCALE}"/>
     <classpath>
       <pathelement path="${JDBC_CLASSPATH}"/>
       <pathelement path="${CLASSPATH}"/>
                <pathelement
location="jars/load.jar"/></classpath></java></target>

 <target name="load" depends="compile">
   <jar jarfile="jars/load.jar" compress="false"
        basedir="classes"
        includes="org/spec/jappserver/load/**/*.class"/></target>

 <!-- Compile charts -->
 <target name="compile-charts">
   <echo message="The classpath for compilation is
${compile.classpath}:jars/jcchart450K.jar" />
   <javac srcdir="src"
          deprecation="on"
                   debug="on"
                   destdir="classes"
                   includes="**/charts*/*"
                   target="1.2"
classpath="${compile.classpath}:jars/jcchart450K.jar"/>
 </target>

 <target name="charts" depends="compile-charts">
   <jar jarfile="jars/charts.jar" compress="false"
        basedir="classes"
        includes="org/spec/jappserver/charts/*.class"/>
 </target>

</project>

------------------------------------------------------------------------
---------------------
end build.xml
------------------------------------------------------------------------
---------------------


appserver:
JBoss.3.2.5
------------------------------------------------------------------------
---------------------
end appserver
------------------------------------------------------------------------
---------------------

JBoss.3.2.5.env
# Generic environment needed for the apps server
JAS_HOME=c:\\SPEC\\
JAVA_HOME=C:\\Java\\j2sdk1.4.2_07
J2EE_HOME=c:\\Java\\j2sdkee1.4.2_07

# Environment needed for the driver
CLASSPATH=${J2EE_HOME}\\lib\\j2ee.jar;${JAS_HOME}\\jars\\SPECjAppServer-
client.jar
BINDWAIT=3

# Environment needed for the DB loader
# JDBC_CLASSPATH=${J2EE_HOME}\\lib\\mcp.jar

# Additional environment needed for make
JAVAX_JAR=${J2EE_HOME}\\lib\\j2ee.jar

# The following variables specify the URL of the
# server in which the SPECjAppServer beans are deployed
# JAS_PREFIX used to access the Web components
# For Example DeliveryServlet. Default is \\
JAS_HOST=trj1d1p2
JAS_PORT=8580
JAS_PREFIX=\\

# The following variables specify the URL of the server
# in which the Supplier Emulator is deployed
# EMULATOR_PREFIX used to access the Web components
# For Example EmulatorServlet. Default is \\
EMULATOR_HOST=trj1d1p2
EMULATOR_PORT=8580
EMULATOR_PREFIX=\\

#
# AppServer Environment variables for JNDI provider and classes
#
NAMING_PROVIDER=jnp://trj1d1p2:1599
JNDI_CLASS=org.jnp.interfaces.NamingContextFactory


# needed if the App server host is not specified in the cmd line
JAVA="$JAVA_HOME\\bin\\java -Dorg.omg.CORBA.ORBInitialHost=$JAS_HOST"

# We need to export all variables needed by make
export JAS_HOME JAVA_HOME J2EE_HOME JAVAX_JAR JAS_HOST JAS_PORT
EMULATOR_HOST EMULATOR_PORT

------------------------------------------------------------------------
---------------------
end JBoss.3.2.5.env
------------------------------------------------------------------------
---------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)



©2008 ant-tasks.com - Jax Systems, LLC, U.S.A.