One goal of the JikesRVM project over recent years has been the ability to develop JikesRVM in a development environment such as Eclipse. This has been possible for the MMTk component since 2005, and as of early 2007 (release 2.9.0) it is possible to work with the majority of the JikesRVM codebase in Eclipse and similar environments. With Jikes RVM release 2.9.1, setting up your Eclipse environment to work with Jikes RVM became even easier.
Editing JikesRVM in Eclipse
These instructions assume you are working with Jikes RVM version 2.9.1 or later.
Create a JikesRVM source tree either via Mercurial checkout or untar-ing a distribution.
- Create the machine-generated files and eclipse metadata:
If you have a recent version of Jikes RVM (3.0 onwards):
Note that if you will not or cannot build on your local machine, substitute localhost for the name of a host you can build on (buildit will perform the build remotely and then copy the requisite files back).
If you are working on an older version (2.9.1 - 2.9.3), you can follow this procedure:
If you will not or cannot build on your local machine:
- copy your tree to build build host somehow
- perform the above ant tasks
- copy the following generated files and directories back to the machine you will edit on:
- Import the newly created Eclipse project into your Eclipse workspace.
- From Eclipse, select File-->Import
- Select "Existing Projects Into Workspace"
- Browse to find the top-level directory.
- Select the project (in this case JikesRVM ia32-linux development)
- Hit Finish
Setup for easier compliance with the Checkstyle rules
If you consider contributing changes back to the RVM, it is helpful to configure your IDE to comply with the Jikes RVM coding style. The coding style forbids the use of tabs and requires that no line ends with whitespace.
If you have a separate workspace for your work with Jikes RVM, you can set up Eclipse for correct tab usage by configuring the text editors. Go to Window -> Preferences and then to General -> Editors -> Text editors (Eclipse 3.6) or Window -> Preferences -> General -> Editors -> Text Editors (Eclipse 3.5 and earlier). Check "Insert spaces for tabs". Make sure that "Displayed tab width" is set to 2. This setting affects the non-Java editors (e.g. XML editor for the ant files for the build).
To set the tab width for Java code, you need to setup the Java code style. We currently do not provide a style template, so you will have to define your own. Go to the project properties (e.g. via Project -> Properties) and select Java Code Style -> Formatter. Check the box "Enable project specific settings" and create a new profile for Jikes RVM. Edit the new profile. In the edit dialog, choose the tab "Indentation". Set the tab policy to "Spaces only" and set both indentation size and tab size to 2. Also make sure that the box "Empty lines" at the bottom of the "Indentation" tab is not checked.
To ensure that you do not introduce whitespace at the end of lines you can configure Eclipse's Save actions in the project properties at Java Editor -> Save Actions. Check the box "Enable project specific settings" and the box "Perform the selected actions on save" as well as "Additional actions". Press "Configure" and check the box "Remove trailing whitespace" in the "Code Organizing" tab.
Editing JikesRVM in NetBeans
- Follow the instructions for Eclipse including building the eclipse project with ant
- Install the Eclipse project importer
- Select File -> Import Project -> Eclipse Project
- Choose to import project ignoring project dependencies
- Select the top-level directory you created with the JikesRVM in as the project to import
- Select a new folder as the destination (workspace) for the import
- Hit Finish