You cannot use both -jar
and -cp
on the command line – see the java documentation that says that if you use -jar
:
the JAR file is the source of all user classes, and other user class path settings are ignored.
You could do something like this:
java -cp lib\*.jar;. myproject.MainClass
Notice the ;.
in the -cp
argument, to work around a Java command-line bug. Also, please note that this is the Windows version of the command. The path separator on Unix is :
.