How to use the org.json Java library with Java 7

自古美人都是妖i 提交于 2019-12-17 23:43:04

问题


I need some simple JSON parsing in my application and the Douglas Crockford library seems exactly what I need.

However, I seem to be running into a problem. I'm getting the following error:

Exception in thread "main" java.lang.UnsupportedClassVersionError: org/json/JSONObject : Unsupported major.minor version 52.0

I Googled around a bit and I get the impression that this is due to some version incompatibility. I've tried changing Java versions but it doesn't seem to help. I'm using Java 7 and Java 7 features in my program and ultimately I want to use Java 7.

How can I resolve this issue?

PS: I looked at Jackson and GSON and definitely don't want to use either so please don't suggest as an alternative.


回答1:


Have you tried using an older version of the package?

Try: http://mvnrepository.com/artifact/org.json/json/20140107




回答2:


Since your are using JDK1.7, change to the older version will work!

<groupId>org.json</groupId>
    <artifactId>json</artifactId>
    <version>20140107</version>
</dependency>


来源:https://stackoverflow.com/questions/27352672/how-to-use-the-org-json-java-library-with-java-7

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