Eclipse the IDE is one of the best examples of a huge desktop application written in Java.
Most Java applications I've seen usually rely on a batch or shell script to build a string with the class path of the application, and launch the JVM with the class path as an env variable.
Eclipse, on the other hand, relies on a native launcher. Why is that ? What does this launcher do that scripts don't ?
I remember reading an article about a year and a half ago that explained that "we're better off with a native launcher", but id did not explain the inner workings of the launcher.
PDE provides an Eclipse Application launcher which allows you to run and debug your plug-in by launching a separate Eclipse application.
The Equinox launcher uses JNI to start the Java VM in the same process as the launcher. Using JNI also allows us to use SWT widgets in the splash screen.
Actually, you can still have a script, since the launcher executable, eclipse.exe, has been broken into 2 pieces since 3.3M5:
The executable lives in the root of the eclipse install.
The shared library is in a platform specific fragment, org.eclise.equinox.launcher.[config]
, in the plugins directory.
Moving the majority of the launcher code into a shared library that lives in a fragment means that that portion of the launch code can now be updated from an update site. Also, when starting from java, the shared library can be loaded via JNI in order to display the splash screen.
As explained here, you can start Eclipse 3.3 without the native launcher,
java -jar plugins/org.eclipse.equinox.launcher_1.0.0.v20070319.jar
Note that the name of the jar-file is now version dependent causing naive scripts, that invoke the jar using the exact filename, to break once the jar-file gets updated.
Instead you may want to look for a file matching org.eclipse.equinox_*.jar
. Thankfully the Eclipse-wiki contains appropriate scripting templates that are useful in this case.
If you want to avoid modifying existing scripts, you can also search for the Equinox Launcher plug-in, copy it into the Eclipse main directory and rename the copy into startup.jar.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With