Posts

What is PATH and CLASSPATH in java and why do we need it?

Image
Which environment variables do I need to set on my machine in order to be able to run Java programs? or Difference between PATH and  CLASSPATH? PATH and  CLASSPATH are the most important and basic environment variables which are used to compile and execute a java program.  First let us discuss about the PATH. PATH is an environment variable which will point to the JDK binaries like "javac", "java" and "javap" commands. "javac" command is used to compile the java program and the "java" command is used to run/execute the java program. If you have installed java in your system you can view where these commands exists, and that location is the 'PATH' variable in your system. So to simplify, PATH specifies the location where the exe files like java.exe, javac.exe, appletviewer.exe, javap.exe exists.        You can use the below Command to set PATH in Windows set PATH=%PATH%; C:\Program Files\Java\jdk1.8.0_281\bin If you don&