Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

ClassNotFound Exception in my run target

Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I am attempting to setup a ANT script that will eventually run my jar.

Here is the run target:

<!-- - - - - - - - - - - - - - - - - -
target: run
- - - - - - - - - - - - - - - - - -->
<target name="run" depends="jar">
<java jar="build/jar/nlpxfer.jar" fork="true">
<arg line="-Xmx150m"/>
<arg value="RISS_Spec"/>
<arg value="\\\public\bill\L3"/>

I have in my classpath:

<path id="classpath">
<pathelement path="${junit.jar}"/>
<pathelement path="${jdom.jar}"/>
<pathelement path="${}"/>
<pathelement path="${xercesImpl.jar}"/>
<pathelement path="${xmlParserAPIs.jar}"/>

<property name="classpath" refid="classpath"/>

When the jar is executed, I get this error in my stacktrace

Caused by: java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver

Shouldn't the class have been loaded up and ready for use? Am I not calling it correctly? I have used path=${classpath} pathref=${classpath} etc...

How do I ensure the proper jars are loaded up w/ ANT?

Thank you.
Posts: 1364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out the ant manual on java task and Path-like structures (see the part where it says "The following example: :" ... "could be rewritten as: " ... for an example of the syntax to use to reference the path id. I've also modified your code snippet to use classpathref. Then, to see how ant is using your classpath run with the -v option (verbose, ant -v). FYI, you probably want to use <jvmarg> for the "-Xmx150m" arg.

[ February 08, 2006: Message edited by: Carol Enderlin ]
The longest recorded flight time of a chicken is 13 seconds. But that was done without this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic