Joda Time classes don't have any constructors… why? And what am I doing wrong?

▼魔方 西西 提交于 2020-01-04 03:00:13

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/16721927/joda-time-classes-dont-have-any-constructors-why-and-what-am-i-doing-wrong

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!