DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Alexey has posted 28 posts at DZone. View Full User Profile

Java: Run Java Application With Classpath Set To The Folder With Jars

04.21.2010
| 3974 views |
  • submit to reddit
        Consider class my.mackage.Main is packed in some jar in 'target' folder, and dependencies are in target/dependencies. Then run the app like this:
java -cp "target\*;target\dependency\*" my.package.Main

Consider that class Main is in current folder and dependencies are in 'lib' folder. Then run the app like this:
java -cp ".;lib\*" Main

Note, there is no *.jar and -cp parameter is double-quoted