How to ensure that external can classes are loaded when called from the eclipse plugin?

I developed an eclipse plugin that references an external jar present in the external installation directory. Therefore, I added an entry to my path to the package path, as shown below:

Bundle-ClassPath: external:C:\mylib.jar

My class loads correctly - and the plugin can detect the class MyClasspresent in this external one lib.
However, the method a()- I call in the class MyClassdoes not work.

The a () method is as follows:

public void a()
{
  URL url = this.class.getClassLoader().getResource("META-INF/startup-jar ");
  ...
}

therefore, the returned URL is the directory of the eclipse plugin C:\eclipse3.4\test and not the physical location of the external jar, which isC:\mylib.jar

a(). , -
jar, ( )

, classloader URL- , ?

. , , . , , , jar, URL.

-

, :: .

URL url = this.class.getClassLoader(). getResource ( "startup-jar" )

URL- eclipse - - C:\eclipse3.4...

URL- ( ).

, , eclipse.

- - API- , , , .

, , , dir, eclipse.

+3
1

OSGI /? , , Hibernate, .

, OSGi, Spring: www.springsource.com/repository/app

, JAR, .

+1

Source: https://habr.com/ru/post/1735015/


All Articles