Joda时间类没有任何构造函数...为什么?我做错了什么? [英] Joda Time classes don't have any constructors... why? And what am I doing wrong?
问题描述
显然,Eclipse上的Scala试图说服我 DateTime
, Period
, DateMidnight
和许多其他类在Joda时间没有任何构造函数
这是奇怪的考虑到事实,他们的文档显示一个构造函数和方法数量
我可以访问的只有静态方法,如 DateTime.now()
DateTime.parse()
请注意,我已经添加了 joda-time-2.2 .jar
, joda-time-2.2-sources.jar
和 joda-time-2.2-javadoc.jar
文件到项目的java构建路径...
然而每当我尝试做一个实例 DateTime
Eclipse会告诉我 org.joda.time.DateTime没有构造函数
<任何人都有任何想法,为什么我得到这个错误?
看来你需要添加 joda-convert
到您的类路径。从此处获得的答案。
如果您不使用Maven或Sbt,您可以从其Maven Central页面手动下载该jar 。所有你需要做的是将它添加到你的项目构建路径。
Apparently Scala on Eclipse tries to convince me that DateTime
, Period
, DateMidnight
and many other classes in Joda Time don't have any constructors
Which is odd considering the fact that the documentation for them shows a constructor and a number of methods
The only things I have access to are the static methods such as DateTime.now()
and DateTime.parse()
Note that I have added the joda-time-2.2.jar
, joda-time-2.2-sources.jar
, and joda-time-2.2-javadoc.jar
files to the java build path of the project...
and yet whenever I try to make an instance of say DateTime
Eclipse will tell me org.joda.time.DateTime does not have a constructor
So anyone got any idea why I get this error? And more importantly, how do I fix it?
It seems you need to add joda-convert
to your classpath. Answer taken from here.
If you're not using Maven or Sbt, you can manually download the jar from its Maven Central page. All you need to do is add it to your project build path.
这篇关于Joda时间类没有任何构造函数...为什么?我做错了什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!