0

当我从 Eclipse 运行我的 Java Swing 应用程序时,它运行良好。但是当我尝试将它作为 jar 文件运行时,它无法识别我引用的库(bluecove-2.1.1-SNAPSHOT.jar)并给我以下错误:

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)

我创建 jar 文件的方式有问题还是 bluecove jar 本身有问题?

4

2 回答 2

1

这很简单

右键单击项目->构建路径->配置构建路径->订购和导出

如果没有复选标记,请检查是否标记了 bluecove 库

于 2014-03-20T06:53:04.687 回答
0

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 :)

于 2014-03-23T08:38:26.247 回答