title: running specific class main function from jar file. import seems not working
body: <p>I have a jar file without its main class specified in manifest.
  So i followed an answer given here:</p>
  
  <p><a href="https://stackoverflow.com/questions/5474666/how-to-run-a-class-from-jar-which-is-not-the-main-class-in-its-manifest-file">How to run a class from Jar which is not the Main-Class in its Manifest file</a></p>
  
  <p>It seems to try to run main from this class. However it looks like importing some other class from this jar file is broken for some reason.</p>
  
  <p>Here is the minimized version of my problem:</p>
  
  <pre><code>jar tf test.jar
  </code></pre>
  
  <p>gives:</p>
  
  <pre><code>META-INF/
  META-INF/MANIFEST.MF
  ClassIWantToRun.class
  something/
  something/something/
  something/something/something/ClassA.class
  </code></pre>
  
  <p>Sources of ClassIWantToRun.class viewed with jd-gui seems to be:</p>
  
  <pre><code>import something.something.something.ClassA;
  
  public class ClassIWantToRun
  {
      public static void main(String[] args)
      {
          int x = ClassA.comeMethod();
      }
  }
  </code></pre>
  
  <p>Running this with:</p>
  
  <pre><code>java -cp test.jar ClassIWantToRun
  </code></pre>
  
  <p>gives me the exception:</p>
  
  <pre><code>Exception in thread "main" java.lang.NoClassDefFoundError: com/ibm/OS4690/FlexosException
      at ClassIWantToRun.main(ClassIWantToRun.java:7)
  Caused by: java.lang.ClassNotFoundException: com.ibm.OS4690.FlexosException
      at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
      ... 1 more
  </code></pre>
  
  <p>I know only basics of Java but it seems that ClassA can not be found even with the line: import something.something.something.ClassA 
  How can i make this run?</p>