This shows you the differences between two versions of the page.
headless_eclipse [2012/08/22 16:30] angelino created |
headless_eclipse [2019/10/06 20:37] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== HEADLESS ECLIPSE ====== | ||
- | |||
- | ===== What is it ? ===== | ||
- | Headless Eclipse is an instance of Eclipse launched without Graphical User Interface, by command-line. | ||
- | |||
- | |||
- | ===== What for ? ===== | ||
- | |||
- | You can use headless Eclipse to run a console application plugin for Eclipse. One of the purposes of such an operation, as seen with SQUANER, is to automatically delegate processing to Eclipse from a web application. Indeed, in order to create a [[padl|PADL]] model of a C++ project, SQUANER let Eclipse parse the project and give its AST. | ||
- | |||
- | |||
- | ===== How to use it ? ===== | ||
- | |||
- | First, create your plugin with Eclipse IDE, within the plugin development environment. | ||
- | In the plugin.xml file of your plugin (root lever of the project), give a specific id to your plugin. You should have a file like this: | ||
- | |||
- | ''<?xml version="1.0" encoding="UTF-8"?> | ||
- | <?eclipse version="3.4"?> | ||
- | <plugin> | ||
- | <extension | ||
- | id="Id_of_the_plugin" | ||
- | point="org.eclipse.core.runtime.applications"> | ||
- | <application | ||
- | cardinality="singleton-global" | ||
- | thread="main" | ||
- | visible="true"> | ||
- | <run | ||
- | class="Package_name.Starting_class_name"> | ||
- | </run> | ||
- | </application> | ||
- | </extension> | ||
- | </plugin>'' | ||
- | |||
- | Then, download a second Eclipse which will be used to make the application run (it is the headless Eclipse). | ||
- | In 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. | ||
- | |||
- | |||
- | ===== Known exceptions ===== | ||
- | |||
- | |||
- | ==== Application Name_of_your_plugin_project.Id_of_the_plugin could not be found in the registry ==== | ||
- | |||
- | 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. | ||
- | |||
- | ==== java.lang.NoClassDefFoundError ==== | ||
- | |||
- | 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// |