Quantcast
Channel: Run a JAR file from the command line and specify classpath - Stack Overflow
Browsing all 6 articles
Browse latest View live

Answer by HankCa for Run a JAR file from the command line and specify classpath

Alternatively, use the manifest to specify the class-path and main-class if you like, so then you don't need to use -cp or specify the main class. In your case it would contain lines like this:...

View Article



Answer by tars for Run a JAR file from the command line and specify classpath

You can do these in unix shell: java -cp MyJar.jar:lib/* com.somepackage.subpackage.Main You can do these in windows powershell: java -cp "MyJar.jar;lib\*" com.somepackage.subpackage.Main

View Article

Answer by Sid for Run a JAR file from the command line and specify classpath

Run a jar file and specify a class path like this: java -cp <jar_name.jar:libs/*> com.test.App jar_name.jar is the full name of the JAR you want to execute libs/* is a path to your dependency...

View Article

Answer by a_horse_with_no_name for Run a JAR file from the command line and...

When you specify -jar then the -cp parameter will be ignored. From the documentation: When you use this option, the JAR file is the source of all user classes, and other user class path settings are...

View Article

Run a JAR file from the command line and specify classpath

I've compiled a JAR file and specified the Main-Class in the manifest (I used the Eclipse Export function). My dependencies are all in a directory labeled lib. I can't seem to get a straight answer on...

View Article


Answer by Tim de Vries for Run a JAR file from the command line and specify...

You can do a Runtime.getRuntime.exec(command) to relaunch the jar including classpath with args.

View Article
Browsing all 6 articles
Browse latest View live


Latest Images