My Java Swing application works fine when I run it from eclipse. But when I try to run it as a jar file, it fails to recognise my referenced libraries (bluecove-2.1.1-SNAPSHOT.jar) and gives me the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: javax/bluetooth/UUID
Caused by: java.lang.ClassNotFoundException: javax.bluetooth.UUID
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 sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
Is there something wrong in the way I am creating the jar file or is there some issue with the bluecove jar itself?
The problem was that I was trying to export it to a jar and then manually adding the main class in manifest.MD and the jars it was using. All I had to do was export it to an 'executable' jar and check the extract all jars option while exporting :)