This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Java in General and the fly likes Exception in thread Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Exception in thread "main" java.lang.NoClassDefFoundErro  " Watch "Exception in thread "main" java.lang.NoClassDefFoundErro  " New topic
Author

Exception in thread "main" java.lang.NoClassDefFoundErro

Amar Naik
Ranch Hand

Joined: Sep 26, 2003
Posts: 43
Hi,

My program compiler with below command

C:\Sun\AppServer\jdk\bin>javac -classpath .;db2jcc_license_cisuz.jar H:\apps\xp\
Desktop\apache-tomcat-6.0.10\webapps\test\WEB-INF\classes\GOOG\MLRCurrentDate.ja
va

When i try to run my program i get the below error
C:\Sun\AppServer\jdk\bin>java -classpath .;db2jcc_license_cisuz.jar H:\apps\xp\D
esktop\apache-tomcat-6.0.10\webapps\test\WEB-INF\classes\GOOG\MLRCurrentDate
Exception in thread "main" java.lang.NoClassDefFoundError: H:\apps\xp\Desktop\ap
ache-tomcat-6/0/10\webapps\test\WEB-INF\classes\GOOG\MLRCurrentDate

Reda Mokrane
Ranch Hand

Joined: Jul 25, 2001
Posts: 235
Did you verify if the MLRCurrentDate.class is in the directory GOOG?
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 13870
    
  10

C:\Sun\AppServer\jdk\bin>java -classpath .;db2jcc_license_cisuz.jar H:\apps\xp\Desktop\apache-tomcat-6.0.10\webapps\test\WEB-INF\classes\GOOG\MLRCurrentDate
Exception in thread "main" java.lang.NoClassDefFoundError: H:\apps\xp\Desktop\apache-tomcat-6/0/10\webapps\test\WEB-INF\classes\GOOG\MLRCurrentDate




When you run a class with the 'java' command, you specify the class name as an argument, not a filename. You are specifying the following as the class name:

H:\apps\xp\Desktop\apache-tomcat-6.0.10\webapps\test\WEB-INF\classes\GOOG\MLRCurrentDate

That is not a valid class name. Instead of doing it like that, you should add the directory H:\apps\xp\Desktop\apache-tomcat-6.0.10\webapps\test\WEB-INF\classes to the classpath and specify the class name: GOOG.MLRCurrentDate

Like this:

C:\Sun\AppServer\jdk\bin>java -classpath .;db2jcc_license_cisuz.jar;H:\apps\xp\Desktop\apache-tomcat-6.0.10\webapps\test\WEB-INF\classes GOOG.MLRCurrentDate


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Exception in thread "main" java.lang.NoClassDefFoundErro
 
Similar Threads
example insert method in StringBuffer
apache-tomcat-6.0.10 startup error
TOMCAT error
Java application crashes because of ODBC
Convert OutputStream data to String