ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Colgrave <colgr...@hursley.ibm.com>
Subject Re: javac cannot find package even though it is present in theclasspath
Date Mon, 18 Dec 2000 12:40:31 GMT
This is how I compile code against j2ee.jar:

<target name="classes" depends="prepare">
    <javac srcdir="${src}/Java"
           destdir="${build}/classes">
        <classpath>
            <pathelement location="D:/j2sdkee1.2.1/lib/j2ee.jar"/>
        </classpath>
    </javac>
</target>

I prefer to have explicit control over the classpath rather than relying on the
system classpath.  I usually have other things (other pathelements or other
paths) in the classpath also but this is all that you need for j2ee.jar.
--
Regards,

John Colgrave
colgrave@hursley.ibm.com


Todd Feather wrote:

> I'm fairly new to Ant as well,  so take this as the hack that it is.
>
> I had the same problem recently on a project I was working on. My compile
> was also fine from the shell.
>
> I tried a bunch of different things, but could never get it to work with a
> JAR file. (In my case I needed the j2ee.jar file.)
>
> I may be missing an easier way to deal with this, but I had to unjar the
> files for the compile to work within Ant. I'm building to a JAR, so it
> wasn't that terrible since I was going to re-jar everything to deploy it
> anyway, but it is certainly not an ideal approach.
>
> I hope someone can respond with the "correct" solution.
>
> Todd
>
> ___________________
> Todd Feather
> todd_feather@yahoo.com
> 925.695.2020 x1082
>
> -----Original Message-----
> From: Dominic Fernandes [mailto:savage_ant2000@yahoo.com]
> Sent: Friday, December 15, 2000 2:15 PM
> To: ant-user@jakarta.apache.org
> Subject: javac cannot find package even though it is present in the
> classpath
>
> Hi,
>
>     I started working on ant about a week back. I use
> ant on Win NT. I am facing a fairly strange problem. I
> use javac to compile few jav files, out of which a
> file imports the package 'oracle.jdbc.*'. This package
> is contained in the file classes12_01.jar. Even though
> classes12_01.jar is in the system Classpath it can't
> seem to find it, and gives the following error -
> .
> .
> .
>     [javac] Compilation args: -d
> C:\dominic\TestAnt\classes -classpath
> "C:\dominic\classes12_01.jar;C:\dominic\TestAnt\classes;C:\put-039;C:\ant\li
> b\ant.jar;C:\Program
> Files\JavaSoft\Jaxp1.0.1\jaxp.jar; C:\Program
> Files\JavaSoft\Jaxp1.0.1\parser.jar;
> C:\jdk1.3\lib\tools.jar;
> C:\dominic\sodlib.jar;C:\dominic\sodclient.jar;C:
> \dominic\sodserver.jar;C:\dominic\sodrequest.jar;C:\dominic\3270;C:\iPlanet\
> iAS6
> \ias\usr\java\lib\tools.jar;C:\iPlanet\iAS6\ias\usr\java\jre\lib\rt.jar;C:\i
> plan
> et\ias6\ias\classes\java\activation.jar;C:\iplanet\ias6\ias\classes\java\jms
> .jar
> ;C:\iplanet\ias6\ias\classes\java\servlet.jar;C:\iplanet\ias6\ias\classes\ja
> va\m
> ail.jar;C:\iplanet\ias6\ias\classes\java\xml.jar;C:\iplanet\ias6\ias\lib\jav
> a\jd
> bc20.jar;C:\iplanet\ias6\ias\lib\java\javax.jar;C:\iplanet\ias6\ias\lib\java
> \kfc
> jdk11.jar;C:\iplanet\ias6\ias\lib\java;C:\iplanet\ias6\ias\lib\java\ldapjdk.
> jar;
> C:\iplanet\ias6\ias\APPS;C:\iplanet\ias6\ias\lib\java\ktjdk11.jar;C:\iplanet
> \ias
> 6\ias\lib\java\kadmin.jar;C:\ant\lib\jaxp.jar;C:\ant\lib\parser.jar;C:\iPlan
> et\i
> as6\ias\usr\java\lib\tools.jar" -sourcepath
> C:\put-039\Code\Phase1 -g -O
>     [javac] File to be compiled:
>     C:\put-039\Code\Phase1\util\WebStatLogger.java
>
>     [javac]
> C:\put-039\Code\Phase1\util\WebStatLogger.java:6:
> package oracle.jdbc does not exist
>     [javac] import oracle.jdbc.*;
>     [javac] ^
>     [javac] Note:
> C:\put-039\Code\Phase1\util\WebStatLogger.java uses or
> overrides a deprecated API.
>     [javac] Note: Recompile with -deprecation for
> details.
>     [javac] 1 error
>
> BUILD FAILED
>
> C:\ant\lib\Test.xml:52: Compile failed, messages
> should have been provided.
>
> Total time: 7 seconds
>
> The classpath displayed here shows that
> classes12_01.jar is present in the classpath. When I
> compile the same file at the command prompt using the
> same iPlanet javac, it compiles fine.
>
> Does anyone have suggestions on what I may overlooking
> here.
>
> Thanks,
>   Dominic
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Shopping - Thousands of Stores. Millions of Products.
> http://shopping.yahoo.com/


Mime
View raw message