Solved

NoClassDefFoundError msg

Posted on 2003-11-29
11
360 Views
Last Modified: 2010-03-31
I have WebCrawler.java and CrawlerExcpetion.java under c:\src\dkim18\crawler\ and I have WebCrawler.class and CrawlerExcpetion.class under c:\classes\dkim18\crawler\. When I run this program under c:\classes\dkim18\crawler\ dir, I have the following error msg:

Exception in thread “main” java.lang.NoClassDefFoundError: c:\classes\dkim18\crawler\

Why am I having this error?

0
Comment
Question by:dkim18
11 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 9843065
Have you compiled all the classes?
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 9843079
Please post the full error message too:

>>Exception in thread “main” java.lang.NoClassDefFoundError:

misses out the most important piece of info (the class name)
0
 
LVL 92

Expert Comment

by:objects
ID: 9843267
Ensure c:\classes is in your classpath, and you are specifying the full classname:

java dkim18.crawler.WebCrawler
0
 
LVL 92

Expert Comment

by:objects
ID: 9843272
or you can specify the classpath on the command line:

java c:\classes;%classpath% dkim18.crawler.WebCrawler
0
 

Author Comment

by:dkim18
ID: 9843372
Have you compiled all the classes?
>>yes

Please post the full error message too:
>>Exception in thread “main” java.lang.NoClassDefFoundError: c:\classes\dkim18\crawler\

when I run this :
javac -d classes -sourcepath src -classpath classes src\dkim18\crawler\WebCrawler.java

I got class files under c:\classes\dkim18\crawler\ and run program in this dir.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 92

Accepted Solution

by:
objects earned 100 total points
ID: 9843439
> javac -d classes -sourcepath src -classpath classes src\dkim18\crawler\WebCrawler.java

A lot easier to compile from the same directory as the source files :)
0
 
LVL 7

Expert Comment

by:maheshexp
ID: 9844106
move to directory ..\src and type this command

java -cp "." src.dkim18.crawler.WebCrawler.java
0
 
LVL 92

Expert Comment

by:objects
ID: 9844131
As i mentioned above:

java c:\classes;%classpath% dkim18.crawler.WebCrawler

will work from any directory.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 9845105
Running with this command line:

>>java c:\classes;%classpath% dkim18.crawler.WebCrawler

Will mean that your source file for WebCrawler should start with

package dkim18.crawler;
0
 
LVL 92

Expert Comment

by:objects
ID: 9846447
pretty sure it already does, but if theres a problem it can be dealt with when this problem is solved.
0
 
LVL 92

Expert Comment

by:objects
ID: 9861433
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now