Skip to content
Advertisement

How to launch executable embedded within Eclipse plug-in?

I am building an Eclipse plug-in that have to parse the result of an executable (Linux) to display informations to the user. The executable should be embedded in the plug-in, not installed apart.

I first made a small prototype, in which I’ve embedded a fake executable, then before launching the executable, I extract it into a temporary file, build my command line and then launch it. That worked ok for me.

I’ve just received the real executable, and then realised it was not a standalone executable, but a bunch of libraries, config files and such. It comes also with a script to execute in order to set env variables.

The only option I am seeing now is to extract the whole bunch to a temp directory, set the environment variables according to the script, and then call my executable.

Is my solution valid ? Do you think of a better way to do it ?

Advertisement

Answer

Don’t package the plugin as a jar, instead just use a directory so you don’t have to do any unpacking.

You specify this using

Eclipse-BundleShape: dir

in the plugin MANIFEST.MF.

Note: if you package your plugins in a feature then this setting is overridden by the unpack="true" attribute of the plugin element in the feature.xml file.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement