Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / February 2006

Tip: Looking for answers? Try searching our database.

NoClassDefFoundError problem

Thread view: 
yihucd@gmail.com - 20 Feb 2006 20:30 GMT
I have a small java program(the smiplest I can have). When I tried to
run after compling it, it shows the error:

Exception in thread "main" java.lang.NoClassDefFoundError: test

what might go wrong?

--------------------------------------------------here is what I did
-------------------------
C:\>type test.java
public class test{
       public static void main(String[] args){
               System.out.println("OK");
       }
}

C:\>javac test.java

C:\>dir test.*
Volume in drive C has no label.
Volume Serial Number is B496-E852

Directory of C:\

02/20/2006  02:27 PM               404 test.class
02/20/2006  09:51 AM                93 test.java
              2 File(s)            497 bytes
              0 Dir(s)  11,949,969,408 bytes free

C:\>java test
Exception in thread "main" java.lang.NoClassDefFoundError: test

C:\>
send2r@gmail.com - 20 Feb 2006 20:38 GMT
It is a CLASSPATH problem
java is not able to find your class correctly.
since you are on DOS do the following:
before running your calss -
C:\>echo %CLASSPATH%
C:\>set CLASSPATH=C:\;%CLASSPATH%
C:\>java test
Now it should work

note:
step C:\>echo %CLASSPATH%  is not necessary. But I asked to do so to
make sure that you have some other folder paths in classpath, that
makes your class invisible.
Also, specifying '.' to represant current dir rather than actual
path(like C:\) would be better
ie;
set CLASSPATH=.;%CLASSPATH% instead of step two.
HTH
RC

> I have a small java program(the smiplest I can have). When I tried to
> run after compling it, it shows the error:
[quoted text clipped - 29 lines]
>
> C:\>
Roedy Green - 24 Feb 2006 20:34 GMT
>NoClassDefFoundError

see http://mindprod.com/jgloss/caq.html
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.