Solved

NoClassDefFoundError msg

Posted on 2003-11-29
11
363 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
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 
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
 
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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

809 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