Over a million developers have joined DZone.

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

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

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}