This page is out of date, and seems to be a duplicate of Eclipse Setup for Java Developers, so please read that page instead.
The ICU4J source package can be downloaded from the official ICU4 download page. If you want to work on the latest development snapshot or a specific version of ICU4J, you can directly export the source package from the ICU4J SVN repository. For accessing the ICU source code repository, please see this page. This instruction assumes that ICU4J source package is available at C:\icu4j on Windows operating system. If you have ICU4J source package in a different location or using another operating system, please replace C:\icu4j with the actual location.
The ICU4J source package includes several ICU4J sub-component project files. These projects refer JRE via Java Execution Environments. Before importing the ICU4J projects, you must set up Java Execution Environments by following steps.
1. Start Eclipse IDE. Eclipse will prompt you to select a workspace first time. This instruction assumes that you create a new workspace for ICU4J. (Of course, you can use an existing workspace and import ICU4J projects there.)
2. Select [Window] - [Preferences] to open workplace preferences screen.
3. Navigate to Java - Installed JREs - Execution Environments in the tree view in the left pane, then select J2SE-1.5 in the Execution Environments list at the center.
If you do not see any matches in the Compatible JREs list, you have to configure a JRE in the workspace by navigating into Java - Installed JREs, then click Add to register a matching JRE (for this case, JRE 5) installed on your system.
Note: You do not need JREs showing [perfect match] in the list to build ICU4J on Eclipse. For example, JRE 6 can be used for ICU4J sub-component projects using J2SE-1.5 as the execution environment. However, Eclipse IDE displays warnings if there is no perfect match.
4. Also make sure the execution environment JavaSE-1.6 has at least one match above. If no matches, register JRE 6 on your system to the workspace.
Once you configure the workspace, the next step is to import ICU4J sub-component project files into the workspace. This task is done by following steps.
1. Select [File] - [Import] to open the screen below.
Select Existing Projects into Workspace in the screen above, then click Next.
2. Specify C:\icu4j\main as the root directory (If you have the source package in a different directory, replace C:\icu4j with the actual location), then click browse.
You should see ICU4j sub-components projects (icu4j-charset, icu4j-charset-tests...) in Projects list like above. Click Finish.
3. While importing the projects, you might see the error message below. But you can just click OK and ignore the message.
4. After the projects are imported into the workplace, you should see the list of projects in the Package Explorer view as below. (Note: All error indicator icon should be disappeared after Eclipse IDE finishes the import operation.)
5. Build all ICU4J projects by selecting [Project] - [Build All] in the menu. Now, ICU4J projects imported into the workplace is completely built and ready to work.
6. If you are going to work on sample/demo code, also import the projects under the demos tree parallel to main.
7. If you are going to work on tools, also import the projects under the tools tree parallel to main.
After the ICU4J projects are imported and built on the Eclipse IDE, you can run the ICU4J test suite to make sure the ICU4J works properly. To run the test suite, follow the steps below.
1. In Package Explorer view, open icu4j-test-framework project, then navigate into src - com.ibm.icu.dev.test and select TestAll.java
2. Select [Run] - [Run Congigurations...] in the menu to open the screen, then select Java Application in the left pane. Click New launch configuration icon to create a new configuration for TestAll.java.
3. Open Arguments tab and specify -n as Program arguments.
4. Open Classpath tab and select User Entries in the Classpath: list, then click Add Projects... to open the Project Selection screen below.
In this list above, check icu4j-charset, icu4j-charset-tests, icu4j-collate, icu4j-collate-tests, icu4j-core-tests, icu4j-currdata, icu4j-langdata, icu4j-regiondata, icu4j-translit and icu4j-translit-tests, then click OK. (Note: icu4j-core is already included in the classpath because of the build dependency. Also, ICU4J Locale SPI test suite is not a part of the regular ICU4J test suite.)
5. In the Run Configurations screen, click Run to launch the test suite. You should see test output in the Console window in the Eclipse IDE. The test suite usually takes a few minutes. After all tests are passed, you should see the log like below in the Console window.
Note: On Eclipse Juno (4.2) releases, you may need to run [Project] - [Build All] to let ICU's customer builders to copy data files to appropriate locations. I did not see this issue in Eclipse 3.x and clean projects automatically triggered the desired ICU customer target.
For ICU developers, the suggestion is to install:
For non-ICU developers, JRE 5 is optional.