[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform] Re: How to execute an external program from a plugin


FileLocator#find(Bundle bundle, IPath path, Map override)
will return a URL for the entry in your bundle.
Then
FileLocator.toFileURL(URL)
will extract the entry to a cache (normally under the configuration/org.eclipse.osgi directory) and return the URL to the location on disk.


If you have an Activator for your bundle, you can get your Bundle object from the BundleContext, otherwise you could use Platform#getBundle

The FileLocator class is in org.eclipse.equinox.common

-Andrew

Stanley Hillner wrote:
Hello,

iÂve built a plugin that calls an external c#-Program to import some things using the .Net-Framework.
Ok, during the development of the plugin everything works fine (The program "*.exe" lies in a subfolder named "temp" of the project) because the plugin is loaded from the project, so it has a real filepath which I get using the getInstallUri-Method.


Now my problem: When I export the plugin as a jar the exe cannot be launched because the file lies within the jar.
So is there any possibility to execute the program at this location or if not, how can i export a plugin as a directory so that eclipse is able to load the plugin like a jar (I just tried to extract the contents of the exportet jar and add the directory to the eclipse-plugin folder but as IÂve expected eclipse didnÂt load the plugin).


Thanks for the moment!