Search code examples
javaosgiequinox

Executing code before OSGI


We have a software based on the eclipse platform, that logs many important messages. To get these messages, we have a tool, that collects these logs, saves them in a zip-file and deletes the old logs.

Now we want, that our tool is executed when the user starts our software (by clicking on the executable), but before anything is already logged. However, we can't find a solution.

What we have tried so far:
We thought of packing it in an OSGI-bundle and force it to start early. That's not possible (or not wanted), because before the bundles are loaded, there are already messages in the logs.

Another try was to use the -startup parameter for the executable to start our tool (it works automatically) and then execute the launcher. However, there were two problems:

  1. We can't start the tool, we get a NoSuchMethodError: run-exception. There's neither a method in the code, nor is such a method ever called by us.

  2. We don't know how to start the equinox-launcher.

Is there a way to start our tool prior to loading the osgi-platform?


Solution

  • Why not write your own launcher?