简体   繁体   English

从 Maven 导入 json-simple 失败

[英]Import json-simple from Maven failed

I'm practicing Java JSON programming using JSON-Simple on this site which says:我正在这个网站上使用 JSON-Simple 练习 Java JSON 编程,它说:

All the jars available in maven repo is supported.支持 maven repo 中可用的所有 jars。

UPDATE:更新:

So I've now added the external maven library to project.所以我现在已经将外部 Maven 库添加到项目中。

在此处输入图片说明

But I still can't get it work.但我仍然无法让它工作。

I tried我试过

import com.googlecode.json-simple.JSONObject;

but got:但得到:

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

Then I tried然后我试过了

import com.googlecode.json_simple.JSONObject;

but got:但得到:

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

How to make it works?如何使它起作用?

I'm pretty sure you forgot to add external maven library to project.我很确定您忘记将外部 Maven 库添加到项目中。 Check this out:看一下这个: 在此处输入图片说明

...and enter: org.apache.clerezza.ext:org.json.simple:0.4 ...并输入:org.apache.clerezza.ext:org.json.simple:0.4

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM