Pages

Tuesday, December 24, 2013

Difference between Path and CLASSPATH

Path -> all the operating system application executable paths should be there.

CLASSPATH -> is specific to JAVA only. The compiled .class file should be present in the CLASSPATH location specified in the environment variables so as to get it executed from cmd prompt.
CLASSPATH should be set for the java file(in the environment variable) if we are executing the java class from cmd prompt. CLASSPATH should contain the path of the generated .class file.

When the jdk is first time installed to a m/c, user should put the jdk path upto bin in the 'Path' variable as jdk is an app for OS.

JAVA_HOME -> is used to replace the path till jdk ../../bin or lib in tomcat run.bat,etc

2 comments:

  1. Difference between path and classpath in Java
    path is set for use java tool in your java program like java, javac, javap. javac are used for compile the code. and classpath are used for use predefined class in your program for example use scanner class in your program for this you need to set classpath.

    ReplyDelete
  2. difference between path and classpath

    Path is set for use tools in java like javac, java, and classpath is used for fetch predefined classes of java in java program

    ReplyDelete