jQuery in Action, 3rd edition
The moose likes Beginning Java and the fly likes classpath Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "classpath" Watch "classpath" New topic


richard stockman

Joined: Apr 11, 2006
Posts: 11
Hi, I have been doing a java course and up until now all my programs have compile and worked fine. No I have started getting the noclassdeffound error.
The following is in the autoexec.bat where I put it.

set path=%path%;c:\jdk1.5.0_06\bin\
set classpath=%classpath%;.\

When I compile a java file it compiles fine and puts the class in the current directory, they just wont execute.

I have just recently installed nestcape v8.1. It may be just a coincedence.
Ayub ali khan
Ranch Hand

Joined: Oct 20, 2005
Posts: 394
Hi Richard,

I too encountered a similar problem today. NoClassDefFoundError message is related to the CLASSPATH Environment variable. I resolved it by adding a semicolon at the end of the variable value.

add ; to whatever is there in the classpath variable in the autoexec.bat file and check. If this does not work, try the below procedure..

say you would like to add c:\MyWorkingDir to call CLASSPATH... which has c:\olddir

I did not edit the autoexec.bat file. In Windows it is recommended to use the following procedure: (on XP) Right Click MyComputer > Properties > Advanced Tab > Environment Variables > under System Variables section, select CLASSPATH > EDIT.

Change the CLASSPATH to c:\oldir;c:\MyWorkingDir;

Click Ok. OK.

Open a new DOS session and try to check if everything is working...

All the best !!
[ April 11, 2006: Message edited by: Ayub ali khan ]

SCEA part I,TOGAF Foundation
richard stockman

Joined: Apr 11, 2006
Posts: 11
thanks for that. I have just edited the path in the system variables rather than using autoexec.bat which apparently is the way to do it in older versions of windows and everything is working again. I think it was the quicktime installation which seemed to have changed everything. Goodbye quicktime!!
Arun Thakur

Joined: Mar 15, 2006
Posts: 17
Just do one thing............
go to your directory where the java file are stored through command prompt.
then type
javac -classpath "."*.java

Thats it.

Your code will execute
I agree. Here's the link: http://aspose.com/file-tools
subject: classpath
jQuery in Action, 3rd edition