Java: Run Java Application With Classpath Set To The Folder With Jars
Join the DZone community and get the full member experience.Join For Free
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.MainConsider 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
Opinions expressed by DZone contributors are their own.