且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

线程“main”中的异常java.lang.NoClassDefFoundError:org / joda / time / ReadableInstant

更新时间:2023-02-18 22:36:23

据推测,你的jar不包含清单头告诉Java将joda-time jar添加到类路径中。这是使用 java -jar 时获得其他类路径条目的唯一方法。您可以使用Ant 清单任务直接执行此操作,或者可能有多个其他方法,包括从现有的类路径构建它。

Presumably, your jar doesn't contain a manifest header telling Java to add the joda-time jar to the classpath. That's the only way to have other classpath entries when using java -jar. You could do this directly with the Ant manifest task, or there are probably multiple other ways to do it, including building it from your existing classpath.

或者,尝试

java -cp myapp.jar:joda-time-2.0.jar com.foo.YourMainClass