• 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 ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

NoClassDefFound invoking Java from ANT  RSS feed

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

My ANT task, which aims to invoke a Java class, specifies this:

<target name="callJava">
<java classname="MyHelperClass">
<arg value="xyz"/>
<classpath>
<pathelement path="${java.class.path}"/>
<pathelement path="${dirPath}/actions/java/"/>
</classpath>
</java>
</target>

The MyHelperClass.class is compiled in the folder "${dirPath}/actions/java/".

However, when I run the ANT script I get :
java.lang.NoClassDefFound: MyHelperClass

Has anybody any ideas? I'm sure I've had similar ANT scripts run successfully with almost identical situations.

All ideas greatly appreciated,

Jordan.
 
drifter
Posts: 1364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What version of ant are you using? Are you sure that your callJava build target is exactly like you posted?

I don't get a NoClassDefFound exception unless I add fork="true" to the java task, I get this with 1.6.2 and 1.5.4:

[java] Could not find MyHelperClass. Make sure you have it in your classpath

Did you try running ant with -v (verbose) option. Sometimes an error will be obvious with the verbose output.

Is your class defined in a package? Can you run it on the command-line with "java MyHelperClass xyz"?
 
if you think brussel sprouts are yummy, you should try any other food. And this tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!