Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Headless entrypoints (Buckminster)

Revision as of 08:20, 19 December 2006 by Thomas.tada.se (Talk | contribs)

Below are various possibilities of running a Buckminster command. Note that in all cases, this has the same benefits and drawbacks as running any command line app; detecting errors is up to checking exit codes, you may have to parse text etc. On the other hand it's really simple. If you need more control than this you must write an Eclipse plugin and interface to the 'real' Buckminster API's available.

From Java — command line

If you wish to invoke Buckminster directly using Java, this is what you type:

java -jar startup.jar [the rest of the command line]

The buckminster 'binary'

Invoking using the java binary is sometimes tedious. Buckminster therefore provides a script that does this for you. Please note that calling scripts from other executables might be less then trivial. Should problems arise, the fall-back is to call the java binary directly.

From Java — code

As is evident from above, all you really need is to call the entry point in the buckminster_startup.jar and pass in the 'command line' directly. Sample dynamic code:

...
URLClassLoader cl = new URLClassLoader(new URL[] { new File("/some/path/startup.jar").toURI().toURL() });
Class<?> c = cl.loadClass("org.eclipse.core.launcher.Main");
Method m = c.getMethod("run", new Class[] { String[].class });
Integer exitCode = (Integer)m.invoke(c.newInstance(), new Object[] {new String[] { "lscmd", "--style", "short" }});
...

From Ant

There are no specific Ant tasks (unless you write them yourself), but calling the commands from Ant is fairly simple as it follows from the able code sample:

<target name="sample">
   ...
   <java jar="startup.jar" fork="true">
       <arg value="lscmd"/>
       <arg value="--style"/>
       <arg value="short"/>
   </java>
   ...
</target>

Note the use of 'fork'. At this time using a fork value of false is not supported.

Back to the top