I am having trouble trying to use an imported class from a jar file which is located in the referenced libraries of my project.
So I have a project which has the pydev.jar file in the Referenced Libraries. Pydev.jar contains org.python.pydev.navigator.elements.PythonNode, and I have imported this in one of the Java files. Eclipse does not give an errors when I import and use this in the Java file but when I run the project as an Eclipse application there is a java.lang.NoClassDefFoundError: org/python/pydev/navigator/elements/PythonNode exception being thrown.
Code is trying to cast an ISelection to a PythonNode as below:
IStructuredSelection sel = (IStructuredSelection)
window.getSelectionService().getSelection();
ArrayList<String> testNames = new ArrayList<String>();
Iterator<?> itr = sel.iterator();
String testName = "";
String testSuite = "";
while(itr.hasNext()) {
PythonNode selectionElement = (PythonNode) itr.next();
testName = selectionElement.toString();
testSuite = selectionElement.pythonFile.toString();
testNames.add(testSuite + "." + testName);
}
If anyone can explain why the Exception is being thrown for the use of the PythonNode class at runtime I would be very appreciative. As far as I can see it is imported correctly as it is visible in the Referenced Libraries.
I think you’re building either Eclipse RCP or Eclipse plugin. Am I right?
If yes, you should put pydev.jar under plugin dependencies. Go to plugin.xml, Runtime and put pydev.jar in the classpath