0

In older days, we needed to do following things to run a java program:

a. set JAVA_HOME=<Installation directory of jdk>
b. set PATH=%JAVA_HOME%\bin;%PATH%;.
c. set CLASSPATH=%JAVA_HOME%\lib;%CLASSPATH%;.

My queries are:

  1. Is the step c still needed?
  2. If the step c is/was done to include the jar files in the JDK lib folder, then how does it actually work? (because normally we need to include the jar file explicitly, for example set CLASSPATH=C:\files\afile.jar;%CLASSPATH%;. Simply giving the folder path of jar files does not suffice, how does it suffice here?)
tshepang
  • 12,111
  • 21
  • 91
  • 136
Gaurav
  • 1,570
  • 4
  • 20
  • 25
  • Why don't you try it? [Possible answer](http://stackoverflow.com/a/1975801/180100) –  Nov 06 '13 at 18:22

1 Answers1

0

You do not need to add the JDK lib directory to the classpath so no, step 3 is not needed. The classes in Java's standard library are automatically available to the JVM, you do not need to put them in the classpath explicitly.

Jesper
  • 202,709
  • 46
  • 318
  • 350
  • Sounds good as RC also pointed out, but how did this arrangement(step c) ever worked (as I mentioned in 2nd query), any ideas? – Gaurav Nov 06 '13 at 18:48
  • @Gaurav as far as I know it never did and this was never necessary with any version of the Sun/Oracle JDK. – Jesper Nov 06 '13 at 21:51