I am using:
I have created a Java project using emacs and have the following project and classpath files:
.project
<?xml version="1.0" encoding="UTF-8"?> <projectDescription> <name>snaprequest</name> <comment></comment> <projects> </projects> <buildSpec> <buildCommand> <name>org.eclipse.jdt.core.javabuilder</name> <arguments> </arguments> </buildCommand> </buildSpec> <natures> <nature>org.eclipse.jdt.core.javanature</nature> </natures> </projectDescription>
.classpath
<?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="src" path="src"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="output" path="bin"/> </classpath>
I have this version
In my Java program I want to use the JSONObject so I tried to import the following:
import org.json.JSONObject;
And when I try and compile on the command line I get this error:
error: package org.json does not exist import org.json.JSONObject;
I know I need to add something on my classpath so it can find the jar files, but I am not sure how?
In my case i was using maven build tool and got this error so had to add below dependency from here like below and error resolved.
<dependency> <groupId>org.json</groupId> <artifactId>json</artifactId> <version>20180130</version> </dependency>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With