title: Run jar with dependencies from the command line
body: <p>Java can run jar files from the command line like this:</p>
  
  <pre><code>java -jar foobar.jar
  </code></pre>
  
  <p>However, if <code>foobar.jar</code> depends on <code>baz.jar</code>, the above will throw an exception as soon as any of the classes in <code>baz.jar</code> is invoked, as the JVM has no way to know where to look for these.</p>
  
  <p>However, the man page (OpenJDK 8 on Linux) states that:</p>
  
  <blockquote>
    <p>When you use the <code>-jar</code> option, the specified JAR file is the source of all user classes, and other class path settings are ignored.</p>
  </blockquote>
  
  <p>If repackaging is not an option, is there a way to run a jar file with dependencies from the command line?</p>