Eclipse Quick Pick Guide (1)

xiaoxiao2021-03-06  40

Eclipse is a very good open source IDE, which is ideal for Java development, due to support plug-in technology, has received more and more developers. The latest Eclipse 3.0 not only has a large increase in interface, but also increases many excellent functions such as code folding, and there is also a significant increase in speed. With a lot of dazzling plug-ins, it can fully meet the development of the company's Java to the mobile terminal Java game. This article will take you into the vast world of Eclipse, in detail how to develop ordinary Java programs, web applications, J2EE applications, mobile Java programs, and how to perform unit testing, reconstruction, configuring CVS, etc. under Eclipse.

My development environment is JDK1.4.2 Eclipse3.0 Windows XP SP2, if you encounter any problems on other platforms, welcome to communicate.

1. Install JDK1.4

Eclipse is a development environment based on the Java platform. It itself is also available on the Java virtual machine, but also use JDK compiler, so we must first install JDK. JDK1.4 is currently the most stable version, and is also the required condition of Eclipse running. First download the JDK1.4 Windows version from Sun's official site http://java.sun.com, the latest is 1.4.2_06, then run J2SDK-1_4_2_06-Windows-i586-P.exe installation, you can set it yourself Install the directory, I installed it into the D: /software/j2sdk1.4 directory.

Next to configure the environment variable so that the Java program can find the installed JDK and other configuration information. Right click on "My Computer", select "Properties", select "Advanced", "Environment Variable" in the pop-up dialog box, you can see the environment variable dialog box: The above is the user variable, only valid for the current user, below It is a system variable that is valid for all users. If you want all users to use, click "New" under the system variable, fill in: Java_home is the JDK installation directory, and many developments that depend on JDK rely on JDK, so it must be guaranteed correctly.

Next, find the system variable PATH, click "Edit", in the last purchase of the Directory of the JDK executable, ie% java_home% / bin, my corresponding directory is D: /software/j2sdk1.4/bin, attached In the PATH, pay attention to the semicolon ";" separation: Note: If the system has multiple Java virtual machines installed (such as the JDK1.3 that own Oracle 9i), JDK1.4 must be The path is placed in front of other JVMs, otherwise the Eclipse starts an error.

The last system variable is ClassPath, and the Java virtual opportunity searches for the ClassPath settings, but this is not required, you can specify ClassPath when running the Java program, such as running a good Java program in Eclipse, it ClassPath will be set automatically, but in order to easily run the Java program in the console, I suggest it to set a classpath and set it to ".", Note that it is a point "." Represents the current directory. Using users who are usually Windows may think that the Java virtual machine searches for the current directory when searching, in fact, this is the habit in UNIX, for security considerations. Many beginners Java friends are in a hurry to write Hello, World program, and play the java.lang.noclassdeffounderror, which is just not set, just add a current directory "." 2. Install ECLIPSE 3.0

After configuring JDK, the next step is to install Eclipse 3.0, you can download from the official website of Eclipse http://www.eclipse.org, you will see the following version:

● Eclipse SDK ● RCP runtime binary ● RCP SDK ● Platform Runtime Binary ● Platform SDK ● JDT Runtime Binary

Eclipse SDK includes an Eclipse development environment, a Java development environment, a PLUG-IN development environment, all source code, and documents. If you need all your features, you can download this version.

If you are like me, just develop Java applications with Eclipse, not developing an Eclipse plugin or studying an Eclipse code, then downloading a Platform Runtime Binary plus JDT runtime binary is the best choice.

After downloading Eclipse-platform-3.0-win32.zip and Eclipse-jdt-3.0.zip, unzip them to the same directory, do not install, find the Eclipse.exe running in the directory, start screen: Something, The Eclipse interface came out.

If you encounter an error, startup failed, you can check the log file under the Eclipse directory. I have encountered XmlParser anomalies. Carefully check that there is also a virtual machine in the original PATH, put it from the PATH. After the Eclipse is started normally.

3. First Java program

Run Eclipse, select menu "file", "new", "project", create new Java Project, I name it to HelloWorld, then create a Java Class: I name it to HelloWorld, and fill in package for Example, hook "Public Static Void Main (String [] args", click "Finish", Eclipse automatically generates the code frame, we only need to fill in the main method: Under the default setting, Eclipse will automatically compile in the background, we only need Save, then select "Run", "Run As", "Java Application", you can see the output at Eclipse's console.

To debug the Java program is also very simple, the Run menu contains standard debug commands, which can be very convenient to debug applications in the IDE environment. 1.4 version support:

Select menu "Window", "preferences", find "Java", "Compiler", "CompLiance and ClassFiles" in the dialog, change the compilation option to 1.4, you can use the JDK1.4 version of Assert, Make the test more convenient:

转载请注明原文地址:https://www.9cbs.com/read-63774.html

New Post(0)