[英]Problems compiling and running Java app with Bluecove (NoClassDefFoundError)
I have this app that uses bluetooth, so I need both, bluecove and bluecove-gpl packages, when I run it in NetBeans I have no problem at all, and works perfectly fine. 我有一个使用蓝牙的应用程序,因此我需要bluecove和bluecove-gpl软件包,当我在NetBeans中运行它时,我一点都没有问题,并且工作得很好。 But I still can't compile and run from the command line (Ubuntu 11.04). 但是我仍然无法从命令行编译和运行(Ubuntu 11.04)。
I'm using this line for compilation: 我正在使用以下行进行编译:
$ javac -Xlint:unchecked -classpath bluecove-2.1.0.jar:bluecove-gpl-2.1.0.jar Client.java
And it doesn't return errors and it generates a .class file 而且它不会返回错误,并且会生成一个.class文件
Then I try to run the .class file like this: 然后,我尝试运行.class文件,如下所示:
java -classpath bluecove-2.1.0.jar:bluecove-gpl-2.1.0.jar Client
But it returns a NoClassDefFoundError
. 但是它返回一个NoClassDefFoundError
。 Could not find the main class: SPPClient
. 找不到主类: SPPClient
。
Why is this happening? 为什么会这样呢?
You probably need to add your current directory (or whatever directory your class files reside in) to the class path. 你可能需要将当前目录(或任何目录类文件驻留在)添加到类路径。
Try something like 尝试类似
java -classpath .:bluecove-2.1.0.jar:bluecove-gpl-2.1.0.jar Client
or 要么
java -classpath bin:bluecove-2.1.0.jar:bluecove-gpl-2.1.0.jar Client
您需要在清单文件中具有主类定义:
Main-Class: classname
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.