5 Replies Latest reply on Jan 12, 2016 12:42 PM by Bennett

    Edison - Use Google-Gson library with Eclipse (Java)

    Bennett

      I'm trying to use the Google-Gson library with my Java project in Eclipse. In order to use the Mraa library I had to add the mraa.jar file, as well as use the following command in my code:

       

      System.loadLibrary("mraajava");
      
      

       

      I'm assuming this line is looking for the shared object file libmraajava.so (correct me if I'm wrong), but I can't find anything like that for Google-Gson (files located at http://repo1.maven.org/maven2/com/google/code/gson/gson/2.5/).

       

      I can use the Gson library in just a normal Java project by simply adding the Jar, but with the Edison I get the following error:

      Exception in thread "main" java.lang.NoClassDefFoundError: com/google/gson/Gson
        at GsonTest.readWriteGson(GsonTest.java:1204)
        at GsonTest.main(GsonTest.java:233)
      Caused by: java.lang.ClassNotFoundException: com.google.gson.Gson
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
      

       

      I've referenced the Jar as such:

      Capture.JPG

       

      Any help would be greatly appreciated! Thanks!