This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Ant, Maven and Other Build Tools and the fly likes NoClassDefFoundError Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "NoClassDefFoundError" Watch "NoClassDefFoundError" New topic


Yan Lee
Ranch Hand

Joined: Sep 15, 2003
Posts: 94
I have a build file that compiles 2 .java classes(--compile task) and executes the class with the main() method(--execute task).
I get the following error in the execute task.
[java]java.lang.NoClassDefFoundError: WrapperTest (wrong name src/WrapperTest)
How can I rectify this? I am attaching the build.xml
<project default="execute">
<target name="init">
<!-- set global properties for this build -->
<property name="src" location="./src"/>
<property name="build" location="./build"/>
<property name="build.path" location="./build/src"/>
<target name="compile" depends="init">
<javac srcdir="${src}" destdir="${build}" />
<target name="execute" depends="compile">
<java classname="WrapperTest">
<pathelement path="${build.path}"/>
<echo message="${build.path}"/>
Thanks in advance.
prashant patel
Ranch Hand

Joined: May 02, 2000
Posts: 69
do u have any package declared, try giving the pull package name + class name.

I agree. Here's the link:
subject: NoClassDefFoundError
It's not a secret anymore!