json-lib系列包报错原因

来源:互联网 发布:java培训课程安排 编辑:程序博客网 时间:2024/05/21 09:51

我的JDK是1.6,json-lib换了好几个版本还是不行,jsonArray与list之间的转换始终进行不了,之前也用到jsonArray与String之间的转换报错,不得不改用org.json.jar那个包;今天再次遇到这个问题,我决心找出原因:

Json-lib comes in two flavors, depending on the jdk compatibility. json-lib-x.x-jdk13 is compatible with JDK 1.3.1 and upwards. json-lib-x.x-jdk15 is compatible with JDK 1.5, includes support for Enums in JSONArray and JSONObject. Please reffer to the appropriate javadoc links available in the project menu.

Json-lib requires (at least) the following dependencies in your classpath:

  • jakarta commons-lang 2.5
  • jakarta commons-beanutils 1.8.0
  • jakarta commons-collections 3.2.1
  • jakarta commons-logging 1.1.1
  • ezmorph 1.0.6
就是说json-lib的版本需与jdk版本对应,我用的是json-lib-x.x-jdk15,我的JDK1.6所以没问题;问题在于第二个:json-lib需要上面5个jar包支持,而我缺少最后一个ezmorph 1.0.6包!加上之后问题解决。
原创粉丝点击