title: Execute jar file with multiple classpath libraries from command prompt
body: <p>I have a Maven project which generates a jar file and copies all dependencies to <code>target/lib</code> folder.  I want to execute this project on client's machine (windows).  So, I copied <code>myproject.jar</code> to <code>C:\xyz</code> folder and all dependencies to <code>C:\xyz\lib</code> folder.  How do I execute this project from client's command prompt?
  I tried to use <code>java -cp lib\*.jar -jar myproject.jar</code> from <code>C:\xyz</code> folder but it throws following error.</p>
  
  <pre><code>Exception in thread "main" java.lang.NoClassDefFoundError: lib\commons-codec-1/3/jar
  Caused by: java.lang.ClassNotFoundException: lib\commons-codec-1.3.jar
      at java.net.URLClassLoader$1.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(Unknown Source)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
      at java.lang.ClassLoader.loadClass(Unknown Source)
  Could not find the main class: lib\commons-codec-1.3.jar.  Program will exit.
  </code></pre>
  
  <p>I think if I specify all dependencies in classpath (like <code>java -cp lib\dep1.jar;dep2.jar</code>), it will get rid of the problem but I don't want to do this as I have 40 libraries already and it might grow in future releases.  Is there a better way to do this?</p>