title: How do I use manifest.mf class-path for alternative main in same jar?
body: <p>I have created an executable jar file that contains two main classes. All libraries are included in the jar and the main Main-Class works fine when executing like this:</p>
  
  <blockquote>
    <p>java -jar MyApplication.jar</p>
  </blockquote>
  
  <p>But when I try to run the other main class like this:</p>
  
  <blockquote>
    <p>java -cp MyApplication.jar my.other.mainClass</p>
  </blockquote>
  
  <p>It does not include the classpath of the manifest.mf and it can not find the libraries that are in the jar file.</p>
  
  <p>Is there a simple way so that the other main class can use the classpath from the manifest.mf? or should I create two separate executable jars?</p>