Set CLASSPATH In Java

By specifying -classpath or -cp will override CLASSPATH environment variable, that may be created before. 

If the -cp or -classpath are not setted correctly, then that particular user's classpath consists of the current directory (.)

Consider the following example

Here I want to add following jar's into classpath for running the application

barcode4j.jar
avalon-framework-4.2.0.jar
commons-cli-1.0.jar

Setting JAVA CLASSPATH In Windows

java -cp barcode4j.jar;avalon-framework-4.1.5.jar;commons-cli-1.0.jar org.krysalis.barcode4j.cli.Main

Setting JAVA CLASSPATH In Unix/Linux

java -cp barcode4j.jar:avalon-framework-4.1.5.jar:commons-cli-1.0.jar org.krysalis.barcode4j.cli.Main





Your email address will not be published. Required fields are marked *