How to run a java class with a jar in the classpath?

Possibly 🙂

# On Unix
java -cp utilities.jar:. mypackage.MyClass

# On Windows
java -cp utilities.jar;. mypackage.MyClass

Basically that’s just including . (the current directory) on the classpath as well as the jar file.

Leave a Comment