General, to run a java class which require class from JAR file library, you have to type full command as follow:
java -classpath /home/huypv/Desktop/my-lib.jar HelloWorld
If you always use my-lib.jar for other projects, you sould add it to CLASSPATH to execute Java class quickly and easily via command.
# We add jar library to CLASSPATH, all current libs are not changed.
export CLASSPTH=$CLASSPATH:/home/huypv/Desktop/my-lib.jar
#Now, execute java class with short command
java HelloWorld
Title:
Set CLASSPATH for running Java class in Ubuntu
Description:
General, to run a java class which require class from JAR file library, you have to type full command as follow: java -classpath /home/huypv...
...
Rating:
4