FreeKB - Understanding CLASSPATH in Java
Understanding CLASSPATH in Java

Home > Search


Simply put, CLASSPATH is a variable that contains a directory, like this:

# Linux
/opt/jars

# Windows
C:\jars

 

Typically, JARs are located in the CLASSPATH directory. A Java application uses CLASSPATH to know what directory contains the JARs.

# Linux
/opt/jars/example.jar

# Windows
C:\jars\example.jar

 

On Linux, this command will temporarily update the CLASSPATH variable to contain a certain directory.

CLASSPATH=/opt/jars

 

The echo command can be used to verify that CLASSPATH now contains /opt/jars.

echo $CLASSPATH

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter a842f in the box below so that we can be sure you are a human.




Comments