Results 1 to 8 of 8
- 09-02-2009, 03:56 PM #1
Member
- Join Date
- Sep 2009
- Posts
- 4
- Rep Power
- 0
Class is there but NoClassDefFoundError
Dear Experts,
lately I keep running into the same problem over and over again.
I have several projects and reference them via their jar files in order to use their classes.
All projects are in one folder and the references are relative.
While compiling everything works fine when running or debugging the program I get something like:
Exception in thread "main" java.lang.NoClassDefFoundError: sequences/AminoAcids as soon ad the first line referencing AminoAcids is hit.
The class exists in the given location and has recently been build so there should be no problem.
Also other classes in the same jar file do not have the same problem.
I fixed the problem before by renaming the packages and rebuilding and other strange approaches.
Please tell me a proper way to solve this problem.
There may be a relation to me using SVN and although having the same directory structure on all the computers
something might cause this problem via this path.
How do I fix such a problem without having to use strange approaches like renaming of packages etc.
Thanks
- 09-02-2009, 04:16 PM #2
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 14
Open up the jar file at the reported location and see if the class really is there.
If the class is not there then your build settings are to blame.
- 09-02-2009, 04:33 PM #3
Member
- Join Date
- Sep 2009
- Posts
- 4
- Rep Power
- 0
Unfortunately, the class is actually in the jar file.
What else could be the problem?
- 09-02-2009, 06:10 PM #4
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 14
The jar is somehow missing from the class path at run time.
Are you perhaps using some custom class loaders e.t.c.
- 09-02-2009, 06:23 PM #5
noclassdeffounderror
Try this and tell if it works:
Executing your program using this command should correct the problem:
java -classpath . helloworld
where helloworld is the name of your compiled class.
OR
place '.' as part of your environment variable CLASSPATH
This tells java that your classpath is your local directory.Ramya:cool:
- 09-03-2009, 08:44 AM #6
Member
- Join Date
- Sep 2009
- Posts
- 4
- Rep Power
- 0
Could there be a problem because I have the same project
in the same folders on several computers and use SVN?
I have the src and the nbproject folders of each project on the repository.
Could having the nbproject folder on the rep corrupt my projects?
Where in Netbeans could I set the classpath?
And which project should set the classpath (AminoAcids class is in Sequences)?
Projects (not classes) are:
Sequences <- Helpers
MassSpecLib <- Helpers
MassSpecLib <- Sequences
MSResultLib <- Helpers
MSResultLib <-Sequences
MSResultLib <- MassSpecLib
MSMSFragmentation <- Helpers
MSMSFragmentation <- MassSpecLib
MSMSFragmentation <- MSResultLib
- 09-03-2009, 08:45 AM #7
Member
- Join Date
- Sep 2009
- Posts
- 4
- Rep Power
- 0
- 11-19-2009, 04:37 AM #8
Similar Threads
-
java.lang.NoClassDefFoundError Exception when I invoke to a class outside projectEJB
By Daniel in forum Enterprise JavaBeans (EJB)Replies: 2Last Post: 01-20-2014, 08:45 AM -
Message NoClassDefFoundError
By karim in forum EclipseReplies: 1Last Post: 03-20-2009, 04:43 PM -
Getting NoClassDefFoundError through quicktime API
By sunil.mact in forum Advanced JavaReplies: 3Last Post: 01-23-2009, 03:59 PM -
java.lang.NoClassDefFoundError
By bizmut in forum EclipseReplies: 3Last Post: 06-15-2008, 01:54 AM -
NoClassDefFoundError
By jon80 in forum New To JavaReplies: 3Last Post: 05-18-2008, 01:20 PM
Bookmarks