Title: RE: Classpath

Jim,

I think you need to specify the full path to the j2ee/lib directory in your fileset.  The path attribute in your classpath element does not set a base path for nested elements.  Thus

      <classpath path="${j2ee_home}">
        <fileset dir="lib" />
          <include name="j2ee.jar" />
        </fileset>
      </classpath>

is equivalent to...

      <classpath>
        <pathelement path="${j2ee_home}" />
        <fileset dir="lib" />
          <include name="j2ee.jar" />
        </fileset>
      </classpath>

I think this might be what you're looking for...

      <classpath>
        <fileset dir="${j2ee_home}/lib" />
          <include name="j2ee.jar" />
        </fileset>
      </classpath>

And this is how I usually include jar files in my classpath.  As you can see it's a little more compact.

      <classpath>
        <pathelement location="${j2ee_home}/lib/j2ee.jar" />
      </classpath>

Best regards,
Lance Peterson
Verticore Technologies Inc.

-----Original Message-----
From: Jim Downing [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 12, 2001 10:57 AM
To: [EMAIL PROTECTED]
Subject: Classpath


Apologies for being stupid here -

I'm trying to get a javac task to have  a classpath that points to a jar file that isn't in the build base directory.  The location of the jar is in a path specified by

an environment variable.  Is it possible to get a fileset to point to this environment specified directory?

My build.xml:

<project name="dbAccessTest" default="compile">
  <property name="src" value="src"/>
  <property name="build" value="build"/>
  <property environment="env"/>
  <property name="j2ee_home" value="${env.J2EE_HOME}"/>
  <property name="java_home" value="${env.JAVA_HOME}"/>
 
  <target name="init">
    <tstamp/>
    <delete dir="${build}"/>
    <mkdir dir="${build}"/>
    <mkdir dir="${build}/lib"/>
    <mkdir dir="${build}/classes"/>
  </target>

  <target name="compile" depends="init">
    <javac srcdir="${src}" destdir="${build}/classes" includes="Account.java">
      <classpath path="${j2ee_home}">
        <fileset dir="lib">
          <include name="j2ee.jar"/>
        </fileset>
      </classpath>
    </javac>
  </target>
</project>

Jim

Reply via email to