Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [pde-dev] Package & Run .exe bundled in Plug-in

Rama,
I've had similar problems when invoking executables from within a plugin itself. Well, what you probably have to do is to calculate the path to the executable bundled in your plugin. This can be done by retrieving the plugin's (bundle) location and clean up some prepended stuff, add the additional directories as necessary according to your plugin uinternal structure. Next step is to use that path as the working directory when launching your executable. I recomemnd that you consider using the ProcessBuilder in the JDK for this. It will produce a Process object for you. I manage to launch Perls scripts and .exe:s (Win32) this way from within a plugin. 

Getting the bundle location: 

in the plugin class (activator):

public void start( BundleContext context ) throws Exception {
    String location = context.getBundle().getLocation();
    ....
}


When it comes to DLL used as native libraries from the plugin, i.e. not an EXE, you need to provide an additional entry in the manifest. This entry is defiend by OSGi, check out the specification it is vey useful in this respect (also). 

Example:

Bundle-NativeCode: /lib/<some.dll> ;
  osname = Win32 ;
 processor = x86



Hope this was of some help,

Robert


-----Original Message-----
From: pde-dev-bounces@xxxxxxxxxxx on behalf of Rama Krishna
Sent: Thu 2007-03-29 00:08
To: pde-dev@xxxxxxxxxxx
Subject: [pde-dev] Package & Run .exe bundled in Plug-in
 
Hi All,

 We have a .exe file (with some dll's) to be packaged in one of our Plug-ins.
 And this exe should be invoked from a Java program in this plug-in.

 (Lets say this exe name is xyz.exe)

 Can you please help me in this?

What i did till now:

 Packaging:

  I create a folder inside this plug-in root and added this folder to build path and
  classpath.

 Runtime:

 Runtime.getRuntime().exec("xyz -f test.txt");

This is not working. Please help me.

Thanks,
Rama Krishna
 




Back to the top