I have to refer generic JSONObject
.
import statement:
import org.json.JSONObject;
is in my project.
But it is loading org.json.JSONObject
from cdh hive jar instead our custom one which is generic.
I found it by typing ctrl+shift+t
It shows hive jar as used and other jars in the workspace.
How do i refer custom one? cdh jar is maven dependency.
EDIT:
Both jars are added as maven dependency. So i couldn't find a way to give preference in eclipse.
Moreover Common project is showing as empty folder and hive jar is there.
It takes org.json.JSONObject
from hive.
You just need to put the jar file you want earlier in the build path in Eclipse, or earlier in the classpath in general. You might want to have a look for a version of CDH / Hive (I haven't used them) which doesn't come bundled with a copy of the JSON libraries - just for sanity's sake, only having a single copy of any one class in your classpath is a good idea.
Alternatively, if CDH already comes with the JSON library, do you need your own separate copy? Could you delete that and just use the one in CDH?
See more on this question at Stackoverflow