I'm trying to use JSON Simple to parse a JSON file into Java in a Gradle JavaFX project.
I've tried a few things:
- Adding
implementation group: 'com.googlecode.json-simple', name: 'json-simple', version: '1.1.1'to thebuild.gradlefile. ... Won't let me doimport org.json.simple.JSONParser;
Error: error: package org.json.simple does not exist
Adding
implementation 'com.googlecode.json-simple:json-simple:1.1.1'to thebuild.gradlefile. ... gives same error as above.In IntelliJ, I've tried manually downloading and adding the jar file:
First I added a new directory to the root called 'libs' and added the jar file there. Went to File > Project Structure > Libraries > '+' > Java, selected the file and pressed the module I wanted to add it to. Then I added requires json.simple; into the module-info.java file.
IntelliJ does not come up with any errors, but when I do gradle run, it comes up with an error in the modules-info.java file that says error: module not found: json.simple
I have no idea why that last error is happening, I made sure the module was applied to the root as well (Where the modules-info.java file is.
I've tried gradle clean, invalidating caches and removing caches altogether.
If anyone knows why this issue is occuring (or can suggest another way I can parse a JSON file), that would be great!
Thanks in advance.