[英]Adding Gson to netbeans java project
I have downloaded gson.jar from its source. 我从它的源代码下载了gson.jar。
Right-clicked at libraries folder -> add new -> add jar -> gson.jar 右键单击libraries文件夹 - >添加新 - >添加jar - > gson.jar
However when i try to use 但是当我尝试使用时
Gson gson = new Gson();
It complains that it cannot find symbol Gson. 它抱怨它找不到符号Gson。
What is the right way how to add gson to the project? 如何将gson添加到项目中的正确方法是什么? I am not using maven 我不是在使用maven
Thanks for help! 感谢帮助!
Go to Download Gson 转到下载Gson
There, access last Gson version: 在那里,访问最后的Gson版本:
You will see sth like this: 你会看到这样的:
In order to import Gson using netbeans you will need to download 3 files from here: 要使用netbeans导入Gson,您需要从此处下载3个文件:
Then, you have to create a library on netbeans: 然后,您必须在netbeans上创建一个库:
It should work now! 它现在应该工作!
I am new to this. 我是新来的。 I used the same method of import that you used. 我使用了您使用的相同导入方法。 It told me that it cannot find symbol Gson so I used CTRL+SHIFT+I to import correct library for gson and now everything is ok. 它告诉我,它找不到符号Gson所以我使用CTRL + SHIFT + I为gson导入正确的库,现在一切正常。 You can also add this import statement import com.google.gson.Gson; 您还可以添加此导入语句import com.google.gson.Gson; to the top of the page. 到页面顶部。 I do apologize about the non-technical formatting of this paragraph. 我为本段的非技术格式道歉。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.