Developing in JDK 1.5 Using Eclipse 3.1Web Age Solutions Inc. IntroductionEclipse 3.1 is the first release with built-in support for JDK 1.5. Previous releases required manual installation a of patch called Cheetah. In Eclipse 3.1, there is no need to install any patches to support JDK 1.5. There are three areas that are affected by your choice to use JDK 1.5.
Install JDK 1.5 and Eclipse 3.1Eclipse itself can be run using JDK 1.4 or older. It is recommended that you download and install JDK 1.5 (instead of 1.4). This JDK can be used to run Eclipse as well as develop and unit test the projects. Download JDK 1.5 from http://java.sun.com/j2se/1.5.0/download.jsp and install it. Download Eclipse 3.1 from this link. Simply unzip the downloaded ZIP file to install Eclipse. Run Eclipse by launching eclipse.exe from the installation directory. Configure EclipseEclipse uses a built-in Java compiler. The compiler supports Java 1.3, 1.4 and 1.5. The level actually followed by the compiler depends on the project settings. You can configure the Java level per project or set it as a default at a global level. Launch Eclipse. From the menu bar, select Window->Preferences. Select the Java->Compiler preference. Set the Compiler Compliance level to 5.0.
Click on OK to accept the changes. Click on Yes to do a full rebuild. Create a Java ProjectFrom the menubar, select File->New->Project. Select Java Project and click on Next. Enter Test as the project name.
Note that system using the default compiler compliance level of JDK 1.5 (shown as 5.0). Click on Next. Click on the Libraries tab.
Note that system has selected the JRE available from JDK 1.5. Click on Finish. Test ConfigurationWe are now ready to develop code in JDK 1.5. In the new project, create a package called com.webage.jdk5. In that package, create a class called Test. Add code shown in bold face below. import java.util.*;
public class Test {
Save changes (Control+S). You should not get any compilation errors. From the menu bar, select Run->Run As->Java Application.
The code should execute fine. System should automatically pick the javaw.exe JVM from the JDK 1.5 installation directory as shown in the top border of the Console. Feedback |