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?)
1
  • Why don't you try it? Possible answer Commented Nov 6, 2013 at 18:22

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

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 as far as I know it never did and this was never necessary with any version of the Sun/Oracle JDK.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.