FAQ How do I find out whether the Eclipse Platform is running?

From Eclipsepedia

Revision as of 16:15, 14 March 2006 by Claffra (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

If you have a library of code that can be used within both the Eclipse Platform and a stand-alone application, you may need to find out programmatically whether the Eclipse Platform is running. In Eclipse 3.0, this is accomplished by calling Platform.isRunning. In 2.1, call BootLoader.isRunning. You will need to set up the classpath of your stand-alone application to make sure that the boot or runtime plug-in’s library is reachable. Alternatively, you can reference the necessary class via reflection.

You can find out whether an Ant script is running from within Eclipse by querying the state of the variable eclipse.running. You can use this information to specify targets that are built only when Ant is invoked from within Eclipse:

   <target name="properties" if="eclipse.running"/>

See Also:


This FAQ was originally published in Official Eclipse 3.0 FAQs. Copyright 2004, Pearson Education, Inc. All rights reserved. This text is made available here under the terms of the Eclipse Public License v1.0.