In an eclipse plug-in I am developing I need to execute an exe file from within the plug-in.
For this, I am using the java code:
p = Runtime.getRuntime().exec(command);
Where p is Process. This works fine.
However when the plug-in is deployed (already when I am using “run eclipse application” in my development environment), the plug-in is looking for the exe file in the folder where my eclipse is located (near the eclipse.exe file). I don’t want to put my exe there.
I want that eclipse will put it inside the plug-in jars (or in some other folder where such resource files can be located), and that the exec command will find it there. Minor addition: to run, my exe file needs a dll which I put in the same directory as the exe. So when it runs from the plug-in the exe needs to be able to find this dll.
How do I do that?
You have to specify the full path of your exe in the
execcommand. To get the full path of the exe within your bundle, useThis is of course only working if your bundle is not deployed as jar file, but as folder. If you want to deploy your bundle as jar file you have to unpack the exe before executing.