Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

NoClassDefFoundError msg

Posted on 2003-11-29
11
Medium Priority
?
367 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

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…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

670 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