title: NoClassDefFoundError/ClassNotFoundException while using SWT
body: <p>I'm stuck with this issue for like 10h, now.</p>
  
  <p><code>mvn clean compile install</code> compiles the code just fine. The problem appears when I try to run the bundled JAR, built to include all dependencies. FYI, it happens while trying to run the project inside Eclipse as well.</p>
  
  <p>I tried using <code>-verbose:class</code> as VM args while running it by the <code>java jar</code> and through the Eclipse IDE. The output shows the JVM loading the "buggy" class, but I still get the exception.</p>
  
  <p>Tried a lot of other options as well, like extracting the SWT native libraries to the same path as the JAR, but that didn't work either. Cleaning the relevant part of my m2 cache didn't help. I also double-checked the bundled JAR for the missing class and, guess what? It's right there.</p>
  
  <p>As most of you may already have understood, this is part of a much bigger project, for which a small test case could not be (easily) created. I tried to create a small sample (without maven) and it's working. Another (probably) relevant piece of info is that I'm using both, SWT and JavaFX in this same class, following working recipes on how to mix them. And I'm using Oracle JDK 1.7.</p>
  
  <p><strong>UPDATE:</strong> tried to move the "small sample" to Maven and it's running ok, so far. I suppose the problem is not related to the maven dependency or something.</p>
  
  <p><strong>UPDATE:</strong> I managed to create a small project that have the same problem. It's an Eclipse project, but should be easily run without IDE (since it's a Maven project). It depends on the Linux x64 version of SWT, but you can change that dependency as well. Please, check it out at <a href="https://dl.dropboxusercontent.com/u/5319290/swtjfx.tar.gz" rel="nofollow">https://dl.dropboxusercontent.com/u/5319290/swtjfx.tar.gz</a></p>
  
  <p>The exception stack trace:</p>
  
  <pre><code>Exception in thread "main" 
  java.lang.NoClassDefFoundError: org/eclipse/swt/widgets/Canvas
      at java.lang.ClassLoader.defineClass1(Native Method)
      at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
      at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
      at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:412)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
      at java.lang.Class.getDeclaredMethods0(Native Method)
      at java.lang.Class.privateGetDeclaredMethods(Class.java:2531)
      at java.lang.Class.getMethod0(Class.java:2774)
      at java.lang.Class.getMethod(Class.java:1663)
      at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:494)
      at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:486)
  [Loaded java.util.Objects from /usr/lib/jvm/java-7-oracle/jre/lib/rt.jar]
  Caused by: java.lang.ClassNotFoundException: org.eclipse.swt.widgets.Canvas
      at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
      ... 19 more
  </code></pre>
  
  <p>The <code>-verbose:class</code> output:</p>
  
  <pre><code>...
  [Loaded org.eclipse.swt.widgets.Layout from file:/home/me/myapp-jar-with-dependencies.jar]
  [Loaded org.eclipse.swt.layout.FillLayout from file:/home/me/myapp-jar-with-dependencies.jar]
  [Loaded org.eclipse.swt.graphics.Drawable from file:/home/me/myapp-jar-with-dependencies.jar]
  [Loaded org.eclipse.swt.widgets.Widget from file:/home/me/myapp-jar-with-dependencies.jar]
  [Loaded org.eclipse.swt.widgets.Control from file:/home/me/myapp-jar-with-dependencies.jar]
  [Loaded org.eclipse.swt.widgets.Scrollable from file:/home/me/myapp-jar-with-dependencies.jar]
  [Loaded org.eclipse.swt.widgets.Composite from file:/home/me/myapp-jar-with-dependencies.jar]
  [Loaded org.eclipse.swt.widgets.Canvas from file:/home/me/myapp-jar-with-dependencies.jar]
  [Loaded org.eclipse.swt.widgets.Decorations from file:/home/me/myapp-jar-with-dependencies.jar]
  [Loaded org.eclipse.swt.widgets.Shell from file:/home/me/myapp-jar-with-dependencies.jar]
  [Loaded java.lang.ClassFormatError from /usr/lib/jvm/java-7-oracle/jre/lib/rt.jar]
  [Loaded java.lang.NoSuchMethodException from /usr/lib/jvm/java-7-oracle/jre/lib/rt.jar]
  [Loaded java.lang.Throwable$PrintStreamOrWriter from /usr/lib/jvm/java-7-oracle/jre/lib/rt.jar]
  [Loaded java.lang.Throwable$WrappedPrintStream from /usr/lib/jvm/java-7-oracle/jre/lib/rt.jar]
  [Loaded java.util.IdentityHashMap from /usr/lib/jvm/java-7-oracle/jre/lib/rt.jar]
  [Loaded java.util.IdentityHashMap$KeySet from /usr/lib/jvm/java-7-oracle/jre/lib/rt.jar]
  [Loaded java.util.Objects from /usr/lib/jvm/java-7-oracle/jre/lib/rt.jar]
  [Loaded java.lang.Shutdown from /usr/lib/jvm/java-7-oracle/jre/lib/rt.jar]
  [Loaded java.lang.Shutdown$Lock from /usr/lib/jvm/java-7-oracle/jre/lib/rt.jar]
  </code></pre>
  
  <p>The relevant part of my POM:</p>
  
  <pre><code>&lt;repositories&gt;
    ...
    &lt;repository&gt;
      &lt;id&gt;swt-repo&lt;/id&gt;
      &lt;url&gt;https://swt-repo.googlecode.com/svn/repo/&lt;/url&gt;
    &lt;/repository&gt;
  &lt;/repositories&gt;
  ...
  &lt;dependencies&gt;
    ...
    &lt;dependency&gt;
      &lt;groupId&gt;org.eclipse.swt&lt;/groupId&gt;
      &lt;artifactId&gt;org.eclipse.swt.gtk.linux.x86_64&lt;/artifactId&gt;
      &lt;version&gt;4.3&lt;/version&gt;
    &lt;/dependency&gt;
  &lt;/dependencies&gt;
  </code></pre>
  
  <p>Any clue? If more information is needed, be my guest and ask for it, please.</p>
  
  <p>Thanks for any help.</p>