# Installing MTJ

This document provides instructions on how to install or upgrade the MTJ plugin/feature set. In addition, once you have finished the installation itself, you will need to configure MTJ's settings (see here) as well as some Eclipse settings.

1. Before you begin
2. Install the Wireless Toolkit(s)
3. Installing via the MTJ Update site
4. Configuring Preprocessor Support

For information on removing EclipseME, see here.

### Before you begin

1. Please make sure you have all the prerequisites.

2. If you have been using Eclipse without MTJ to do J2ME development using a Wireless Toolkit, your Eclipse project may need some classpath changes. See the section on converting an existing project to an MTJ project.

### Install the Wireless Toolkit(s)

Install any of the wireless toolkits you want to use. When you do this, make note of the base directory into which each is installed, as you will need this information when you configure MTJ.

Unix users - if you install a Wireless Toolkit for use by more than one user on your system, please ensure that all the users have the appropriate read and execute permissions on the contents of the toolkit. For example, WTK's contain a preverifier that MTJ will need to access during the build process. If the user doing the build does not have execute permissions on the preverifier, the build will fail. Similarly, if the user does not have execute permissions on the emulator, he or she will not be able to test the build.

### Installing via the MTJ Update site

1. Please visit MTJ update page to get update sites URLs
2. Please refer Eclipse help document or visit Eclipse Help web site, select Workbench User Guide > Tasks > Updating and installing software document node for information about how to install software.

Note: If you would like to take advantage of MTJ's support for preprocessing, it is imperative that MTJ be installed into the same directory structure as your base Eclipse installation. For instance, if your base Eclipse installation (not your workspace) is installed to C:\software\eclipse, you will need to make sure that you install MTJ into C:\software\eclipse.

### Configuring Preprocessor Support

Due to limitations in the extensibility of the Eclipse Java Compiler (see Bug 116143 for further information), it is necessary for MTJ to hook into the Eclipse platform at a lower level in order to provide preprocessor support. If you would like to take advantage of MTJ's support for preprocessing, a few extra changes need to be made to your Eclipse installation.

1. MTJ should be installed into the same directory structure as your base Eclipse installation. When the installation has completed, the org.eclipse.mtj.core.hooks_[version].jar file must be located in the same directory as the org.eclipse.osgi_[version].jar.
2. The Eclipse configuration file must be altered to reference the MTJ framework hooks bundle.
   1. Locate the file config.ini. This file is located in the <eclipse install>/configuration directory.
   2. Edit the config.ini with your favorite text editor.
   3. Add the property definition
      `osgi.framework.extensions=MTJ.core.hooks`
      to the configuration file.
      If the property already exists, append `",MTJ.core.hooks"` to the end of the current property definition.
      It is very important that the line be added before the end-of-file marker. Failure to properly place the new line before the end-of-file marker could cause your Eclipse workbench to fail to start.
   4. Save the configuration file.
   5. Restart Eclipse.

You will be warned if you have projects that are configured for preprocessing, but the necessary configuration changes have not been made. In this case, a warning will be written to the Eclipse workspace log file with text similar to
"Preprocessor invoked, but hook is not installed. Consult the installation instructions for MTJ."
For more information on viewing the workspace log file see the troubleshooting section of the MTJ documentation.

### Next Steps

Once you have completed the steps above, you are ready to configure MTJ and Eclipse. Click here for instructions on how to to that.