• Post Reply Bookmark Topic Watch Topic
  • New Topic

path and classpath?  RSS feed

 
Kriss Reddy
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,

what is path and classpath? I have my j2sdk1.4.2_04 installed on my c drive, How should I set my path and classpath in such a way(if possible) that it should facilitate me to compile and run my java programs no matter where i create and compile and run on my entire hard drive (other than c drive).

Please give me a detailed explanation.

You guys are all doing a great job here and Many thanks in advance.
 
Carol Enderlin
drifter
Ranch Hand
Posts: 1364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is a detailed description in this FAQ, http://faq.javaranch.com/view?HowToSetTheClasspath
 
Barry Andrews
Ranch Hand
Posts: 529
C++ Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To be able to compile and run Java programs you need to have the bin directory of your Java install in your PATH. You do not need to do anything with CLASSPATH. You can either set it like this in your command shell:
SET PATH=%PATH%;C:\j2sdk1.4.2_04\bin
or
set in your system environment PATH.

If you do the first method, you have to set the path every time you open a new shell. It's usually more convenient to set your PATH in the system environment variables unless you need to be able to run more than one version of Java and switch between the 2 easily.
 
Kriss Reddy
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Many thanks for your replies.
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
At this point, I strongly suggest that you DO NOT set your CLASSPATH environment variable. The important part at this juncture is to set the PATH variable so that the operating system will be able to find the Java compiler and runtime executables. Until you start learning about packages and using 3rd party libraries, you don't need to worry about CLASSPATH.

Layne
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!