my dog learned polymorphism*
The moose likes Beginning Java 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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Exception in thread "main" java.lang.NoClassDefFoundError" Watch "Exception in thread "main" java.lang.NoClassDefFoundError" New topic
Author

Exception in thread "main" java.lang.NoClassDefFoundError

Ashish Goradia
Greenhorn

Joined: Jul 27, 2001
Posts: 2
I get this error

Exception in thread "main" java.lang.NoClassDefFoundError: ScreenView (wrong name: programm/ScreenViw)
where programm is the package and ScreenViw is the class
can u please inform me how do I rectify it
the class path is set to c:\prog
and this programm folder is under prog folder in c:\
also I can compile and also get the classes(java classes ) after compilation in the directory
i.e. I can compile
but not run
I dont know
please help
do it as soon as possible
Thanks and Regds,
Sam Dalton
Author
Ranch Hand

Joined: Jul 26, 2001
Posts: 170
Originally posted by Ashish Goradia:
I get this error
I would think that you have your directory naming wron. Your file should be in a directory called programm. Your classpath should be set to the directory that holds the full package. If the case is incorrect this will not work..
S
Exception in thread "main" java.lang.NoClassDefFoundError: ScreenView (wrong name: programm/ScreenViw)
where programm is the package and ScreenViw is the class
can u please inform me how do I rectify it
the class path is set to c:\prog
and this programm folder is under prog folder in c:\
also I can compile and also get the classes(java classes ) after compilation in the directory
i.e. I can compile
but not run
I dont know
please help
do it as soon as possible
Thanks and Regds,


<a href="http://www.samjdalton.com" target="_blank" rel="nofollow">Sam Dalton</a>,<br />Co-author of [http://www.amazon.com/exec/obidos/tg/detail/-/1590592255/qid=1068633302//ref=sr_8_xs_ap_i0_xgl14/104-4904002-9274339?v=glance&s=books&n=507846]Professional JSP 2.0[/URL] (October 2003)<br />Co-author of <a href="http://www.amazon.com/exec/obidos/ASIN/1861007701/ref=ase_electricporkchop" target="_blank" rel="nofollow">Professional SCWCD Certification</a><br />Co-author of <a href="http://www.amazon.com/exec/obidos/ASIN/186100561X/ref=ase_electricporkchop" target="_blank" rel="nofollow">Professional Java Servlets 2.3</a>
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
The package declarations are for use during execution. When you are first INVOKING an application the JVM doesn't know what package to look for the class in.
Whatever you are using to drive the application (the class with the main) MUST be in the direct classpath to get found.
Either change your class to be in the \prog directory or change you classpath to include the "current" directory by adding a dot reference (set CLASSPATH=.;c:\prog) and invoke the class from the programm directory or change your class path to include the programm subdirectory.


"JavaRanch, where the deer and the Certified play" - David O'Meara
 
 
subject: Exception in thread "main" java.lang.NoClassDefFoundError