OTEquinox/Howto Run OTEquinox Bundles Standalone

From Eclipsepedia

Revision as of 10:36, 27 February 2010 by Stephan.cs.tu-berlin.de (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Important.png
Change of namespace
In versions upto 1.4.0 (served from www.objectteams.org) the IDs of OT/Equionx bundles start with org.objectteams.

During the project move to Eclipse.org these are being renamed to org.eclipse.objectteams....

The following information has been assembled for OT/Equinox release 1.2.6


Setting up a minimal OT/Equinox Fraemwork outside Eclipse

To set up a minimal OT/Equinox framework runtime outside of Eclipse, you can basically follow the instructions in the Equinox Quickstart Guide. Additionally, the following bundles are required by OT/Equinox, which you can grab from an existing installation or the corresponding download/update sites (e.g. OTDT 1.2 update site, see also http://www.objectteams.org/distrib/otdt.html):

# Object Teams:
org.objectteams.eclipse.transformer.hook
org.objectteams.otdt.pde.core.lib
org.objectteams.otequinox
# Eclipse:
org.objectweb.asm
org.eclipse.equinox.registry
org.eclipse.equinox.common

Using the Equinox Launcher

This method depends on one more bundle (org.eclipse.equinox.launcher), but is easier to configure/start.

The minimal directory structure looks like this:

somedir/
  configuration/
    config.ini
  plugins/
    org.eclipse.equinox.common_<version>.jar
    org.eclipse.equinox.launcher_<version>.jar
    org.eclipse.equinox.registry_<version>.jar
    org.eclipse.osgi_<version>.jar
    org.objectteams.eclipse.transformer.hook_<version>.jar
    org.objectteams.otdt.pde.core.lib_<version>.jar
    org.objectteams.otequinox_<version>.jar
    org.objectweb.asm_<version>.jar

Contents of config.ini:

osgi.framework=plugins/org.eclipse.osgi_<version>.jar

osgi.bundles= \
org.objectteams.eclipse.transformer.hook, \
org.objectteams.otdt.pde.core.lib, \
org.eclipse.equinox.common@start, \
org.eclipse.equinox.registry@start, \
org.objectweb.asm@start, \
org.objectteams.otequinox@start

osgi.bundles.defaultStartLevel=4
eclipse.ignoreApp=true
osgi.noShutdown=true

osgi.framework.extensions=org.objectteams.eclipse.transformer.hook
osgi.hook.configurators.include=org.objectteams.eclipse.transformer.hook.HookConfigurator
ot.equinox=1

Application bundles should be added to osgi.bundles appropriately.

Command line to run the framework:

java -jar plugins/org.eclipse.equinox.launcher_<version>.jar -console

To shutdown and exit the framework, call close on the OSGi console prompt. For automatic shutdown, omit the -console argument and change osgi.noShutdown to true in config.ini.

Alternatively, you can use the native launcher binary as described in the Equinox Quickstart Guide.

w/o Launcher

If for some reason you want to avoid using the Equinox Launcher, the following has to be considered when launching the framework:

  • Directly starting from the JAR file is not possible, because the classpath has to be modified. Instead the main class org.eclipse.core.runtime.adaptor.EclipseStarter has to be invoked.
  • The following bundles have to be on the classpath when starting the framework: org.eclipse.osgi and org.objectteams.eclipse.transformer.hook
  • OSGi boot delegation has to be enabled by setting osgi.compatibility.bootdelegation=true and org.osgi.framework.bootdelegation=org.objectteams.transformer.hook.*

Example start script for Windows OS:

@echo off
set CP=org.eclipse.osgi_<version>.jar
set CP=%CP%;org.objectteams.eclipse.transformer.hook_<version>.jar
set OPTS=-Dosgi.compatibility.bootdelegation=true
set OPTS=%OPTS% -Dorg.osgi.framework.bootdelegation=org.objectteams.transformer.hook.*

java -cp %CP% %OPTS% org.eclipse.core.runtime.adaptor.EclipseStarter -console