Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding Gson to netbeans java project

I have downloaded gson.jar from its source.

Right-clicked at libraries folder -> add new -> add jar -> gson.jar

However when i try to use

Gson gson = new Gson();

It complains that it cannot find symbol Gson.

What is the right way how to add gson to the project? I am not using maven

Thanks for help!

like image 909
Dingo Avatar asked Dec 02 '25 13:12

Dingo


1 Answers

Go to Download Gson

There, access last Gson version:

enter image description here

You will see sth like this:

enter image description here

In order to import Gson using netbeans you will need to download 3 files from here:

  • gson-2.8.0.jar (classpath)
  • gson-2.8.0-sources.jar (sources)
  • gson-2.8.0-javadoc.jar (javadoc)

Then, you have to create a library on netbeans:

  • Right click on Libraries (inside the project in which you want to add Gson)
  • Properties
  • In categories: Libraries
  • Add Library (write a name, e.g.: Gson)
  • You have to import the right file in each of the tabs: classpath, sources, javadoc

enter image description here

It should work now!

like image 82
Alvaro Rodriguez Scelza Avatar answered Dec 05 '25 03:12

Alvaro Rodriguez Scelza



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!