How to run a command when the eclipse plugin is clicked?
<p>I have a Plug-in Project in my Eclipse workspace. When I right click the project and click on 'Run as Eclipse Application', another Eclipse instance is opened and the plug-in is installed successfully. When the plug-in button is clicked, the application opens.</p>

<p>However, when I export the project, create the jar and place the jar under plugins folder, I'm able to see the plugin button, but when I click it, the application is not opening.</p>

<p>Below, I show the java class that is being executed:</p>

<pre><code>Bundle bundle = Platform.getBundle("com.example.eclipse.plugin");
        URL url = FileLocator.find(bundle, new Path("webspy/lib/abc.jar"), null);
        File file=null;
        try {
            url = FileLocator.toFileURL(url);
            file = URIUtil.toFile(URIUtil.toURI(url));

            String[] str={"java", "-jar", file.getAbsolutePath()};
            ProcessBuilder pb = new ProcessBuilder(str);
            Process p = pb.start();
        } catch (URISyntaxException e1) {
            e1.printStackTrace();
        } catch (IOException e1) {
            e1.printStackTrace();
        }
</code></pre>

<p>The <em>plugin.xml</em> file is the following:</p>

<pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;?eclipse version="3.4"?&gt;
&lt;plugin&gt;

   &lt;extension
         point="org.eclipse.ui.actionSets"&gt;
      &lt;actionSet
            label="Sample Action Set"
            visible="true"
            id="com.example.eclipse.plugin.actionSet"&gt;
         &lt;menu
               label="FEAT"
               id="sampleMenu"&gt;
            &lt;separator
                  name="StartWebSpy"&gt;
            &lt;/separator&gt;
         &lt;/menu&gt;
         &lt;action
               label="&amp;amp;Start WebSpy"
               icon="icons/sample.gif"
               class="com.example.eclipse.plugin.actions.SampleAction"
               tooltip="Start WebSpy"
               menubarPath="sampleMenu/sampleGroup"
               toolbarPath="sampleGroup"
               id="com.example.eclipse.plugin.actions.SampleAction"&gt;
         &lt;/action&gt;
      &lt;/actionSet&gt;
   &lt;/extension&gt;

&lt;/plugin&gt;
</code></pre>

<p>It has to run an executable jar once the button is clicked. This is not happening when the plugin jar is placed in plugins folder. Please help what am I missing.</p>