java.lang.NoClassDefFoundError problem with Foursquare library
in
Contributed Library Questions
•
2 years ago
I'm having some problems with Processing Environment. I'm actually using Foursquare Java Library V2 (
https://code.google.com/p/foursquare-api-java/). This code is the basic example found in the project wiki page, but I can't figure out how to run it!
It gives me an error like this
Exception in thread "Animation Thread" java.lang.NoClassDefFoundError: org/json/JSONException
I googled this kind of error and It's caused by a wrong definition of the java CLASSPATH.
Can anyone give me any hint. How I can fix it?
OUTPUT
It gives me an error like this
Exception in thread "Animation Thread" java.lang.NoClassDefFoundError: org/json/JSONException
I googled this kind of error and It's caused by a wrong definition of the java CLASSPATH.
Can anyone give me any hint. How I can fix it?
- String id = "***";
- String secret = "***";
- String callback = "***";
- public void searchVenues(String ll) throws FoursquareApiException {
- // First we need a initialize FoursquareApi.
- FoursquareApi foursquareApi = new FoursquareApi(id, secret, callback);
- // After client has been initialized we can make queries.
- Result<VenuesSearchResult> result = foursquareApi.venuesSearch(ll, null, null, null, null, null, null, null, null, null, null);
- if (result.getMeta().getCode() == 200) {
- // if query was ok we can finally we do something with the data
- for (CompactVenue venue : result.getResult().getVenues()) {
- // TODO: Do something we the data
- System.out.println(venue.getName());
- }
- } else {
- // TODO: Proper error handling
- System.out.println("Error occured: ");
- System.out.println(" code: " + result.getMeta().getCode());
- System.out.println(" type: " + result.getMeta().getErrorType());
- System.out.println(" detail: " + result.getMeta().getErrorDetail());
- }
- }
- void draw(){
- try{
- searchVenues("45.49985,9.191093");
- }catch (Exception e) {
- e.printStackTrace();}
- }
OUTPUT
- Exception in thread "Animation Thread" java.lang.NoClassDefFoundError: org/json/JSONException
- at _03_foursquare.searchVenues(_03_foursquare.java:32)
- at _03_foursquare.draw(_03_foursquare.java:57)
- at processing.core.PApplet.handleDraw(PApplet.java:1631)
- at processing.core.PApplet.run(PApplet.java:1530)
- at java.lang.Thread.run(Thread.java:680)
- Caused by: java.lang.ClassNotFoundException: org.json.JSONException
- at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
- at java.security.AccessController.doPrivileged(Native Method)
- at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
- at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
- at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
- at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
- ... 5 more
1