您的位置首页生活百科

如何解决net.sf.json.JSONObject报错

如何解决net.sf.json.JSONObject报错

的有关信息介绍如下:

如何解决net.sf.json.JSONObject报错

在开发中,我们经常会需要引入net.sf.json.JSONObject。但是我们进入此包后,项目依然报错。那么如何解决net.sf.json.JSONObject报错呢?究竟是什么原因引起的呢?小编来告诉大家。

在开发中我们发现,单一的引入net.sf.json-lib包是没有办法使用JSONObject.fromObject的。

所以,我们需要继续在pom.xml文件中添加

commons-beanutils

commons-collections

commons-lang

commons-logging

net.sf.ezmorph

net.sf.json-lib

等待项目下载工具包,下载完成后,我们在项目中Ctrl+Shift+O,将工具包引入java项目中。

引入工具包import net.sf.json.JSONException;import net.sf.json.JSONObject;

net.sf.json.JSONObject导入报错问题解决。

一、引入net.sf.json-lib时加入jdk15

二、继续引入

commons-beanutils

commons-collections

commons-lang

commons-logging

net.sf.ezmorph

net.sf.json-lib

三、等待下载,下载完成后将工具包导入java项目中。

四、引入工具包import net.sf.json.JSONException;import net.sf.json.JSONObject;