giovedì 26 agosto 2010

Maxine Native Launcher in Eclipse

The Maxine VM can be launched from the command line using the max script, but it can also be launched within Eclipse thru the Native Launcher. This can be really useful if you are developing a Java program or an extension and you want to test it without exiting the IDE.
In order to create a launcher for Maxine, configure the Native Launcher entering the External Tools configurations from the menu, as shown below.

Then create a new configuration, that I called MaxineVM Launcher, and set the Location to the workbench directory ${workspace_loc:/bin/max}. This requires that you have imported all the Maxine projects into the workspace.
Give the configuration the name you want and in the Arguments section place the vm argument (that instruments the max script to start the virtual machine and the classpath to your project classes and qualified class name you want to execute). For instance, if you want to start the class myproject.main.Main of the project MyProject you have to specify:

-classpath ${workspace_dir}/MyProject/classes/myproject.main.Main

This of course assumes that the classes are placed in the classes directorty, otherwise you have to specify the path where your compiled classes are.

Now if you are not doing any change to the Maxine VM sources you can avoid that the launcher triggers a full workspace rebuild, that could be really long, so you can set the launcher in order to build only your project from the selected ones.

Finally, under the Environment tab, you have to specify the JAVA_HOME and JUNIT4_CP variables that the Maxine max script expects to find and use. Having done this configuration, you will be able to start the VM from the IDE.

Nessun commento: