• Post Reply Bookmark Topic Watch Topic
  • New Topic

cant get classpath to work  RSS feed

 
Chris Davies
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi i'm trying to compile the following code using the win2k os



and getting the following error

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

in the environemnt variable settings my classpath is set to C:\AJAVA (where the file .java exists) and and the path is set to C:\j2sdk1.4.0_02\bin;

i changed the autoexec bat file which was pointing to the struts jar file (i haven't rebooted should i do so ?)to now point to C:\AJAVA

when i run the file HelloWorld from the command its the same case as teh java file.

is there something i'm missing ?

cheers

chris
 
Peter van der Linden
author
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chris -- you have to get several things to agree with each other.
What is this StringTester that appears in the error message?

Here are the things that you must do:

1. give the class some name (like HelloWorld)
2. put the class in a file OF THE SAME NAME, HelloWorld.java
3. compile with the full filename:
javac HelloWorld.java
4. Put the path to where the file is, in your classpath
either by putting "." in there, or by putting the full pathname.
5. Run by giving the name of the class (not file)
java HelloWorld

Everything must match, even on letter case.
StringTester makes me think you are overlooking rule two.

Cheers,

Peter
 
Developer Kush
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

Pls set environment variables to the following:

CLASSSPATH = %CLASSPATH%;"path to your jdk in which bin is not included"
PATH = %PATH%;"path to your jdk's bin"

Hope it works ....!!
 
Chris Davies
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks developer kush it worked
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!