code:
package jsonfiles;
import org.json.simple.JSONObject;
public class CreatingJSON {
public static void main(String[] args) {
JSONObject student1 = new JSONObject();
student1.put("name", "Student A");
student1.put("place", "India");
JSONObject student2 = new JSONObject();
student2.put("name", "Student B");
student2.put("place", "US");
System.out.println(student1.toJSONString());
System.out.println(student2.toJSONString());
}
}
// error while creating JSONObject
// error found in the editor "Type safety: The method put(Object, Object) belongs to the raw type HashMap. References to generic type HashMap<K,V> should be parameterized"
Console:
Exception in thread "main" java.lang.NoClassDefFoundError: org/json/simple/JSONObject
at jsonfiles.CreatingJSON.main(CreatingJSON.java:10)
Caused by: java.lang.ClassNotFoundException: org.json.simple.JSONObject
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
... 1 more
Please find the files in the package explorer in the screenshot attached.
PLEASE HELP