• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

Exception in thread "main" java.lang.NoClassDefFoundErro  RSS feed

 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

 
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you verify if the MLRCurrentDate.class is in the directory GOOG?
 
Java Cowboy
Sheriff
Posts: 16084
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!