In Linux, how to execute Java jar file with external jar files?
问题 In Linux, how to execute Java jar file with external jar files? 回答1: Either use the -cp flag: java -cp /path/to/somefolder/*.jar:/path/to/otherfolder/*.jar com.YourMainClass Or add a Class-Path: header to your jar's manifest (see Jigar's answer) Note to others who answered with java -jar <etc> : The -jar flag deactivates the standard -cp flag and CLASSPATH environment variable, because it retrieves the classpath from the JAR manifest. Any answer that combines -jar and either -cp or $CLASSPATH