title: Run a non main class from Spring Boot jar file
body: <p>I have a spring boot jar file and inside it a manifest file as below</p>
  <pre><code>Manifest-Version: 1.0
  Implementation-Title: myApp
  Implementation-Version: 0.1
  Built-By: me
  Implementation-Vendor-Id: com.myApp
  Spring-Boot-Version: 2.0.0.RELEASE
  Main-Class: org.springframework.boot.loader.JarLauncher
  Start-Class: com.myApp.smartlight.BootMongoDBApp
  Spring-Boot-Classes: BOOT-INF/classes/
  Spring-Boot-Lib: BOOT-INF/lib/
  Created-By: Apache Maven 3.6.1
  Build-Jdk: 1.8.0_151
  </code></pre>
  <p>And inside it is a class file named <code>com.myApp.initiate.Initiator</code> <em>(packaged under BOOT-INF/classes folder inside the jar)</em>. I am trying to run Initiator class from command line on Windows machine as below</p>
  <p><code>java -cp myApp.jar com.myApp.initiate.Initiator</code></p>
  <p>but no luck. I also tried mentioning classpath in the above command as</p>
  <p><code>java -cp &quot;myApp.jar;BOOT-INF/*&quot; com.myApp.initiate.Initiator</code></p>
  <p>but it still doesn't work.</p>
  <p>What am I doing wrong?</p>
  <p><strong>Initiator.java</strong></p>
  <pre><code>package com.myApp.initiate.Initiator;
  
  public class Initiator {
  
      public static void main(String... args) {
  
          System.out.print(&quot;hello&quot;);
      }
  }
  </code></pre>
  <p><strong>Update :</strong></p>
  <p><code>Initiator</code> class was packaged under BOOT-INF/classes folder. When I copied it at the jar root and tried below command it worked</p>
  <pre><code>myApp.jar
  |
  |--org
  |--BOOT-INF
  |--META-INF
  |--Initiator.class
  </code></pre>
  <pre><code>java -cp myApp.jar Initiator
  hello
  </code></pre>