I’m using Netbeans IDE 7.0.1.
I base my question on the CalculatorApp sample application available with the IDE.
The sample is running fine but I wish I could use some JSON, ad so I download google-gson-stream-1.7.1.jar library, and included it in my libraries :
– right click on “Library”, then “Properties” then “Add JAR/Folder” and selected my JAR (located somewhere in “My Documents/Download”.
The problem is that when i type the following :
import com.google.gson;
(or even com.google), the IDE fires a “Package com.google does not exist”. The JAR and its hierarchy is correctly shown on the left side pane,in the “Libraries” section. Most surprising, the IDE can autocomplete the com.google.** stuff.
AFAIK, I need to further to get this work, don’t I ? Any ideas ?
Thank you !
In Java, import statements are for classes and interfaces (types) not for packages themselves. Are you sure you tried to import a class under
com.google.gsonpackage and not the package itself?import com.google.gson.Foo;should work.So should
import com.google.gson.*;orimport com.google.*;Note however that wildcard imports aren’t particularly recommended.