Adding an External JAR Configuration to Eclipse for Debugging Applications

The problem is this:

  • I have a third-party Eclipse plugin installed and running

  • The aforementioned Eclipse plugin provides a sorting “extension point” - the source for a class that I can extend / rewrite and replace in the plugin library directory (I’m not saying that this is a great idea, but the need forces us to do something that we are not proud of - internal development has its own quirks)

  • The idea here is to cover any such change to the external JAR (created by us) so that any code change does not require a restart of Eclipse to “update” the point-to-point class during development.

  • In the end, the plugin / package will be created and placed as a dependency on the source plugin - so, as you know, work on this plugin will work.

Question: can I somehow add to the appearance of the JAR file the appearance for debugging / starting the Eclipse application?

Normally adding a JAR to the classpath tab will work for normal debugging / launching of Java applications. However, the Eclipse application does not have this tab.

So far, the efforts (failed, possibly due to some kind of stupid syntax error or something else) included:

  • Adding a JAR as a dependency on the Bundle-ClassPath: plugin as C:\test.jar
  • Adding JAR to system CLASSPATH variable

None of this mattered — the code at the “extension point” that refers to the class in the JAR file, failure — an exception that boils down to:

 Caused by: java.lang.ClassNotFoundException: test.Test at org.eclipse.osgi.internal.loader.BundleLoader. findClassInternal(BundleLoader.java:506) 

Any pointer / help / criticism is appreciated.

Update

Obviously, placing the JAR in the plugin's lib directory and updating the MANIFEST file does not work (not that it helped me, since such a solution will require an “update”, which I try to avoid first), so I have to do something fundamentally wrong.

Does this make any sense or have I missed something in one of these attempts?

+4
source share
2 answers

I included the external JAR file in the Eclipse application ..... not to the debug / launch configurations, but to the application itself.

What we did is wrap the plugin in its own java project. We use maven for our build, so pom.xml lists the dependency as a .jar file (which we put in the lib directory in the project). The manifest.mf file exports the necessary classes. My application plugins depend on this project. When I debug / run the application in the workbench, I just check to see if this library project is included.

I am not sure if this will fully answer your question or not .... but I hope this helps.

+2
source

The first assumption is based on some assumptions:

You are developing an extension for a third-party extension point "foo". Your application is an Eclipse application that you launch using the launch configuration. You need to create a new foo-extension plugin that implements an extension point. You must add a new plugin as plugin dependencies to your application. Thus, it will be available in the project class path, as well as on the Plugins tab of your launch configuration. Select a new project, and when you start the application, the extension will be available with the last change.

+2
source

All Articles