This is an old revision of the document!
A “Headless Eclipse” is an instance of Eclipse launched without any Graphical User Interface, on the command-line.
You can use a Headless Eclipse to call a plug-in in Eclipse from some external programs. One of the purposes of such a call, as seen with SQUANER, is to automatically delegate processing to Eclipse from a Web application. Indeed, to create the PADL model of a C++ project, SQUANER asks Eclipse to parse the C++ project and to return its model.
First, create your plug-in with the Eclipse IDE, within the Plug-in Development Environment (PDE). In the plugin.xml file of your plug-in (root level of the project), give a specific ID to your plugin. You should have a file like this:
<?xml version=“1.0” encoding=“UTF-8”?>
Then, download a second Eclipse that will be used to run your plug-in, i.e., the Headless Eclipse. From the first Eclipse IDE, export your plugin (right-click on your plugin project > Export > Plug-in Development > Deployable plug-ins and framents). Check all needed plugins and export them to the eclipse root folder of your headless Eclipse (the plugins will automatically be put in the plugins folder).
Finally, open a shell on the eclipse root folder of your headless Eclipse and use the following command:
java -cp plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar org.eclipse.equinox.launcher.Main -application Name_of_your_plugin_project.Id_of_the_plugin
Please note that the version of the jar archive may differ in the time; just check the name of the library eclipse/plugin/org.eclipse.equinox.launcher_* and modify the command consequently.
If you see this error in the log file, after launching your headless application, in most cases it means you may have a dependendy issue. Check all the manifest files of your plugin projects and localize all needed resources. Let's remind than a plugin should only depend on other plugins. Not a Java project, not an external library… If you need to use a library, you can create a plugin from the library (in Eclipse IDE, right-click on the Package Exporer > New > Other > Plug-in Development > Plug-in from Existing JAR Archives). Then let your plugin depend on the freshly plug-ined library thanks to the Manifest > Dependencies tab > Required Plug-ins.
It happens that if you use the plugin automatic export, some archives do not contain the class definitions… One solution is to manually export a jar archive of the project with needed class definitions, and rename it to replace the empty archive. One anti-solution is to add the manually exported archive in the class path.
Created by angelino 2012/08/22 11:42