Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

how classpath works??

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't understand how CLASSPATH works? and how JVM finds the path.

I have set environment variable CLASSPATH to c:\jdk1.4\bin . i also tried c:\jdk1.4\bin\
but still i need to use set path=c:\jdk1.4\bin on command prompt.

CLASSPATH doesn't work.

what should i do?
 
author
Posts: 23956
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by aashini shah:
I don't understand how CLASSPATH works? and how JVM finds the path.

I have set environment variable CLASSPATH to c:\jdk1.4\bin . i also tried c:\jdk1.4\bin\
but still i need to use set path=c:\jdk1.4\bin on command prompt.

CLASSPATH doesn't work.

what should i do?




CLASSPATH and PATH environment variables serves two different purposes. The CLASSPATH is used to find the class files. There should be no class files in the jdk bin directory. The jdk bin directory should contain the executables, which you find with the PATH variable.

Henry
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by aashini shah:
...what should i do?


First, you should update your system PATH variable to include c:\jdk1.4\bin so that you don't need to type this all the time. This is covered in step 4 of the JDK installation instructions (assuming Windows).

Second, you should probably remove the system CLASSPATH variable. As Henry pointed out, setting this to the JDK's bin directory does nothing, because you shouldn't have class files there. In fact, this preempts Java's default behavior of looking for classes in the current directory, so it's likely to cause you problems. For background on CLASSPATH, see Setting the class path.
reply
    Bookmark Topic Watch Topic
  • New Topic