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
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
Difference between path and classpath in Java
ReplyDeletepath 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.
difference between path and classpath
ReplyDeletePath is set for use tools in java like javac, java, and classpath is used for fetch predefined classes of java in java program