jantox
jantox

Reputation: 2185

Class loading eclipse rcp

I have an eclipse rcp application. This application will try to load class files from a directory outside the application. However I always get an error of ClassNotFoundException. Do you have any ideas how class loading works in eclipse rcp?

Basically the use case is

  1. Read an xml file - done
  2. Put those xml data in Navigator - done
  3. When user clicks on data in navigator, locate the class in a directory and try to load it - classnotfoundexception

I created a test java project and i added the external class library and it can locate those successfully. However if i intergrate it in eclipse rcp, it throws that error.

Upvotes: 2

Views: 1081

Answers (1)

Francis Upton IV
Francis Upton IV

Reputation: 19443

Eclipse RCP applications use the OSGi class loading support to find the class loader associated with the OSGi bundles (plugins) in your application. If you want to load a class from somewhere, then you need to make a ClassLoader that can load a class from a directory (perhaps use the URLClassLoader). So you will need to create one of these and use it to load the class from the desired location.

Upvotes: 4

Related Questions