why do we need path and class path in our system to run java programs.
Scenario 2: while developing java applications we needed some built in java packages like java.io.BufferedReader,java.lang.Byte,java.math.BigDecimal etc.. and user defined classes like helloworld.class
all the above built in classes will be available in the java intallation directory(C:\Program Files\Java\jdk1.6.0_45\jre\lib)as shown in the below image.
we can check what classes are available in the above jars(making it rename as rt.zip and extract) as shown below.
so when we are running and executing java based applications we needed the above two scenarios.
we can configure the above locations using system variables path and classpath temporarily at command prompt and permanently at environment variables.
ways to setup path and class path.
1)At environment variables
path:
classpath:
2)At command prompt:
set PATH=%PATH%;C:\Program Files\Java\jdk1.6.0_45\bin
set classpath=%classpath%;C:\Program Files\Java\jdk1.6.0_45\jre\lib
How to check whether path and class path are already set in our system.
using dos command echo we can check path and classpath as below.
PATH: echo %path%
CLASSPATH: echo %classpath%
Scenario 1:
if you want to compile or run java based applications we needed java tools like java.exe,javac.exe and javadoc.exe etc..in our system.
all the above tools will be available in the java installed directory for example(C:\Program Files\Java\jdk1.6.0_45\bin)as shown in the below image.
Scenario 2: while developing java applications we needed some built in java packages like java.io.BufferedReader,java.lang.Byte,java.math.BigDecimal etc.. and user defined classes like helloworld.class
all the above built in classes will be available in the java intallation directory(C:\Program Files\Java\jdk1.6.0_45\jre\lib)as shown in the below image.
we can check what classes are available in the above jars(making it rename as rt.zip and extract) as shown below.
so when we are running and executing java based applications we needed the above two scenarios.
we can configure the above locations using system variables path and classpath temporarily at command prompt and permanently at environment variables.
ways to setup path and class path.
1)At environment variables
path:
classpath:
2)At command prompt:
set PATH=%PATH%;C:\Program Files\Java\jdk1.6.0_45\bin
set classpath=%classpath%;C:\Program Files\Java\jdk1.6.0_45\jre\lib
using dos command echo we can check path and classpath as below.
PATH: echo %path%
CLASSPATH: echo %classpath%