2007年5月10日星期四

Preparing ----Project Status of "Java Executable Wrapper Plugin for Eclipse"

My application "Java Executable Wrapper Plugin for Eclipse" to Google summer of code 2007 was acceptted and I am working on it now. This blog will have the real-time record of the progress.

A brief introduction ------What is the project about?
After we written a java application by Eclipse, we should type a command like "java myapp.class" or "javaw -jar myapp.jar" to run our application. Though we can write a .bat file on Windows or write a shell script on Linux to do the job, it feels not very convenience.
The aim of this Google Summer of Code 2007 project is to develop a plugin for Eclipse to wrap compiled Java applications and give out a excutable file. It is supposed to support both Windows and Unix-like Systems.
This plugin will take use of the Eclipse executable application which comes from the "platform-launcher" project in the Eclipse cvs.
This plugin will consist of two main parts.
1).An editor of ".launcher" files. The ".launcher" files contain the required information to generate a executable launcher.
2).A wizard that generates the executable launcher. The wizard can get configuration from users step by step or load it from some ".launcher" configuration files.

Preparing ------ What am I doing now?
1)Learning how to use the Eclipse executable application.
The Eclipse executable application is used to launch the Eclipse IDE in the Eclipse project. Under Windows OS, it is the "eclipse.exe" file. As my mentor Gunnar Wagenknecht advised, it can help us to launch other java applications and it has some nice features (eg. finds JVMs and so on).
As default The Eclipse Launcher will run a "startup.jar". But this can be set to other jar file though command line parameters or one configuration file.
The Eclipse Launcher support a configuration file with the same file name but an extension of ".ini". The content of the configuration file can be the same as the command line parameters but one line can only contain one word.
For example, if we copy the "eclipse.exe" to "mylauncher.exe", and we want to use it to launch "mystart.jar", we should write a "mylauncher.ini" with its content like:

-startup
mystart.jar
-nosplash
-exitdata 0

(Download the example)
The Eclipse Launcher support a lot of parameters.

2)Learning the Eclipse wizard development.
I am reading the book "Eclipse Building Commercial Quality Plug-ins". It is needed to extend class Wizard and WizardPage. I will try some codes soon.

The possible command line parameters of Eclipse launcher

The Eclipse launcher is used to run the Eclipse IDE. Under Windows OS it is the "eclipse.exe".

The possible command line parameters of Eclipse launcher includes :

-vm <javaVM>
the Java VM to be used


-os <opSys>
the operating system being run on


-arch <osArch>
the hardware architecture of the OS: x86, sparc, hp9000


-ws <gui>
the window system to be used: win32, motif, gtk, ...


-nosplash
do not display the splash screen. The java application will not receive
the -showsplash command.


-showsplash <bitmap>
show the given bitmap in the splash screen.


-name <name>

application name displayed in error message dialogs and splash screen window. Default value is computed from the name of the executable - with the first letter capitalized if possible. e.g. eclipse.exe defaults to the name Eclipse.


-startup

the startup jar to execute. The argument is first assumed to be
relative to the path of the launcher. If such a file does not
exist, the argument is then treated as an absolute path.
The default is to execute a jar called startup.jar in the folder
where the launcher is located.
The jar must be an executable jar. e.g. -startup myfolder/myJar.jar will
cause the launcher to start the application: java -jar <launcher folder>/myfolder/myJar.jar

-library

the location of the eclipse launcher shared library (this library) to use. By default, the launcher exe finds


<userArgs>

arguments that are passed along to the Java application (i.e, -data <path>,
-debug, -console, -consoleLog, etc)


-vmargs <userVMargs> ...
a list of arguments for the VM itself


reference:
eclipse.c of the "platform-launcher" in the eclipse cvs
eclipse.c of the "org.eclipse.equinox.executable" in the eclipse cvs