• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 243
  • Last Modified:

No class found.

When trying to run or compile some of the demo programs I get the error NoclassDeffound.  These are the lines that I added to my autoexec.bat file (win98):
set CLASSPATH=.;c:\jdk1.2.2\classes;c:\JavaAI\class

I added the classes directory, and unzipped all the classes zip files that I found into it.
1 Solution

You shouldn't need to unzip the classes zip files.  You can even specify the *.zip files in your CLASSPATH.  This is in my CLASSPATH:


Also, did you restart your computer after changing autoexec and check the settings with the "set" command?  Sounds silly, but that actually burned me once.  Make sure that the CLASSPATH is found.  The NoClassDefFound should tell you what class is missing as well.  That may help you find what *.jar, *.zip or *.class file your classpath is not pointing to.

Good luck!

scottd1978Author Commented:
Ok, where do I run this set command from??  Also, is this path setting recursive?  

You can type it at the command line like this:

C:\>set CLASSPATH=.;c:\jdk1.2.2\classes;c:\JavaAI\class

It will override whatever your current CLASSPATH setting is.

To prepend something to the existing CLASSPATH:

set c:\new\path;%CLASSPATH%

To append:

set %CLASSPATH%;c:\new\path

This has the advantage of setting your classes for the DOS session you are using, but once you reboot, they are lost.  That is why using the ControlPanel System settings or the autoexec.bat file is better in the long run.  You can set it in a DOS session at frist until you get it right, then copy the listing into your autoexec.bat or whatever for when you reboot.

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Is the system able to find your compiler . Are you having a problem trying to compile stuff then In addition to your existing class path you need ,
c:\jdk1.2.2\bin; add this line  to your autoexec and see

I'm using JDK1.2.2 This is my path in autoexec.bat.

SET PATH=%PATH%;C:\jdk1.2.2\bin;
scottd1978Author Commented:
ok ... kewl, I got that error out of the way, but now when I try to run the demo's I get another error.
Exception in thread "main" java.lang.NoSuchMethodError: main


First off, the NoSuchMethodError is caused when you call a method that isn't defined in one of your classes.
You will have to go back and check
that your zip/class files are current.  Is there more information with that error?  You can post it as a separate question if you still are stuck.

Second, if you think one of us answered
your initial question, please accept the appropriate comment as an answer. That way it will end up in the database for others to see...


Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now