【问题标题】:Import json-simple from Maven failed从 Maven 导入 json-simple 失败
【发布时间】:2020-11-03 18:15:21
【问题描述】:

我正在this site 上使用 JSON-Simple 练习 Java JSON 编程,上面写着:

支持 maven repo 中所有可用的 jars。

更新:

所以我现在已将外部 maven 库添加到项目中。

但我仍然无法让它工作。

我试过了

import com.googlecode.json-simple.JSONObject;

但是得到了:

error: ';' expected
import com.googlecode.json-simple.JSONObject;
                          ^

然后我尝试了

import com.googlecode.json_simple.JSONObject;

但是得到了:

error: package com.googlecode.json_simple.parser does not exist
import com.googlecode.json_simple.parser.JSONParser;
                                        ^

如何让它发挥作用?

【问题讨论】:

  • 好吧...然后尝试使用旧版本 com.googlecode.json-simple:json-simple:1.1 并使用 import org.json.simple.JSONObject;

标签: java json lib


【解决方案1】:

我很确定您忘记将外部 maven 库添加到项目中。看一下这个:

...然后输入:org.apache.clerezza.ext:org.json.simple:0.4

【讨论】:

    猜你喜欢
    • 2021-03-26
    • 1970-01-01
    • 2010-11-08
    • 1970-01-01
    • 2017-11-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多