NoClassDefFound 表示找不到 class?

NoClassDefFound means that the class cannot be found?

没看懂NoClassDefFoundError in the context of running an OpenEJB client:

thufir@doge:~$ 
thufir@doge:~$ java -classpath .:NetBeansProjects/HelloClient/dist/HelloClient.jar:apache-openejb-4.7.1/lib/openejb-client-4.7.1.jar org.acme.HelloClient
Exception in thread "main" java.lang.NoClassDefFoundError: javax/ejb/EJBHome

项目缺少class、EJBHome, is in the libray

但未显示在清单中。我如何强制 NetBeans 将 JAR 添加到 class 路径(如果这是解决方案),或者在执行期间将 JAR 包含在 class 路径中?

您在执行时将 jar 文件包含在类路径中,只需将其放入您已经拥有的 jar 文件列表中 - 您已经指定了 openejb-client-4.7.1.jar 等;只需将 javaee-api-7.0.jar 添加到该列表(当然是使用正确的目录)。

NoClassDefFoundError 表示 class 在编译时存在,但在 运行 时不存在。 所以可能你的部署没有 class.