title: Fixing Error: cannot find main class with jar
body: <p>My java game (built using lwjgl and Eclipse) won't run after being exported as a Runnable jar from Eclipse. The program runs fine within Eclipse, and the exported jar has the correct Manifest file format. After executing this Jar, it gave me an error: </p>
  
  <p>C:\Users\7rent\Desktop>java -jar hw.jar</p>
  
  <pre><code>Exception in thread "main" java.lang.reflect.InvocationTargetException
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
  Caused by: java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path
  at java.lang.ClassLoader.loadLibrary(Unknown Source)
  at java.lang.Runtime.loadLibrary0(Unknown Source)
  at java.lang.System.loadLibrary(Unknown Source)
  at org.lwjgl.Sys$1.run(Sys.java:73)
  at java.security.AccessController.doPrivileged(Native Method)
  at org.lwjgl.Sys.doLoadLibrary(Sys.java:66)
  at org.lwjgl.Sys.loadLibrary(Sys.java:95)
  at org.lwjgl.Sys.&lt;clinit&gt;(Sys.java:112)
  at org.lwjgl.opengl.Display.&lt;clinit&gt;(Display.java:135)
  at org.newdawn.slick.AppGameContainer$1.run(AppGameContainer.java:39)
  at java.security.AccessController.doPrivileged(Native Method)
  at org.newdawn.slick.AppGameContainer.&lt;clinit&gt;(AppGameContainer.java:36)
  at core.SecDef.main(SecDef.java:13)
  ... 5 more
  </code></pre>
  
  <p>I then (using Stack overflow answers) used JarSplice to add the lwjgl jar and natives to this Jar. The resulting fatjar gives me this:</p>
  
  <p>C:\Users\7rent\Desktop>java -jar SD.jar</p>
  
  <p>Error: Could not find or load main class core.SecDef</p>
  
  <p>The manifest of the jar contains this:
  <a href="https://i.stack.imgur.com/ccpOH.png" rel="nofollow noreferrer">https://i.stack.imgur.com/ccpOH.png</a></p>
  
  <p>and the inside of the FatJar looks like this:
  <a href="https://i.stack.imgur.com/hVBcD.png" rel="nofollow noreferrer">https://i.stack.imgur.com/hVBcD.png</a></p>
  
  <p>I installed the JRE and JDK today, both latest versions with no configuration done to system variables. The project is set to be in compliance with java 6.</p>
  
  <p>Thanks in advance :)</p>