• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

path and classpath?

 
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
drifter
Posts: 1364
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is a detailed description in this FAQ, http://faq.javaranch.com/view?HowToSetTheClasspath
 
Ranch Hand
Posts: 529
C++ Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Many thanks for your replies.
 
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic