org.json.simple.JSONObject与org.json.JSONObject,JSONException无法解析为一种类型 [英] org.json.simple.JSONObject VS org.json.JSONObject , JSONException cannot be resolved to a type

查看:415
本文介绍了org.json.simple.JSONObject与org.json.JSONObject,JSONException无法解析为一种类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

拳头:org.json.simple.JSONObject和org.json.JSONObject之间的区别的解释?

Fist: an explanation of difference between org.json.simple.JSONObject and org.json.JSONObject ??

第二:我有一个带有org.json.JSONObject和org.json.JSONException的代码.当我在eclipse(JUNO)中编辑代码时,它解析JSONException的类型并导入包org.json.JSONException,但是当我在命令行中使用maven运行项目时,我遇到了一个问题(JSONException无法解析为一种类型).我试图通过将依赖项添加到pom.xml来解决此问题:

Second: I have a code with org.json.JSONObject and org.json.JSONException. When I edit the code in eclipse ( JUNO) it resolves the type of JSONException and imports the package org.json.JSONException but when I run the project using maven in command line I have a problem ( JSONException cannot be resolved to a type). I tried to solve the issue by adding dependency to pom.xml like this :

 <dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1</version>

但是我不确定它是否正确.我什至下载了罐子的组织. java-json.jar并将其添加到Web部署程序集,但仍然是相同的错误.任何人都可以帮忙吗?

but I am not sure if it is the right one . I even download the jar of org. java-json.jar and add it to web deployement assembly but still the same error. Anyone can help ?

推荐答案

org.json和org.json.simple是两个不同的Java库,它们彼此不兼容.它们具有相同的名称只是一个误导性的巧合.

org.json and org.json.simple are two different Java libraries, which are incompatible with each other. The fact that they have the same name is only a misleading coincidence.

比较两个库:

常规比较= http://www.rojotek.com/cn/blog/2009/05/07/a-review-of-5-java-json-libraries/ org.json.simple = http://code.google.com/p/json-simple/
org.json = http://json.org/java

General comparison = http://www.rojotek.com/blog/2009/05/07/a-review-of-5-java-json-libraries/ org.json.simple = http://code.google.com/p/json-simple/
org.json = http://json.org/java

这篇关于org.json.simple.JSONObject与org.json.JSONObject,JSONException无法解析为一种类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆