1
votes

I am trying to use the Gson Java library for ArrayLists to JSON object class use.

My current Bat code for compiling it is this:

      @echo off
      javac -cp ".;/gson-2.8.2.jar" AdobeExtender.java
      java -cp ".;/gson-2.8.2.jar" AdobeExtender
      pause

This is what I am using in my java code to call the class in the jar file

    String aeKeysJson = new Gson().toJson(aeKeys);

I am using the gson-2.8.2.jar. These are all in the same directory. The file will not compile and will not recognize the class gson.

1
What is the error message? What does your import statement for the Gson class look like? - Erwin Bolwidt

1 Answers

0
votes

You have to remove the slash character / before the name of the gson-2.8.2.jar, in this way

@echo off
javac -cp ".;gson-2.8.2.jar" AdobeExtender.java
java -cp ".;gson-2.8.2.jar" AdobeExtender
pause