Java programming things 13-basic use of eclipse

Source: Internet
Author: User

Java programming those things 13 -- eclipse basic use of Chen yuefeng from: http://blog.csdn.net/mailbomb 2.2 Use eclipseEclipse is an open-source and free integrated development tool. Eclipse is one of the mainstream development tools for development. You will be able to use this tool to learn and develop it in the future. If you think of programmers as soldiers in the military, integrated development tools are the guns in your hands. You must be familiar with them and be proficient in using them. To learn development tools, you must use them in learning and use them. 2.2.1 obtain eclipseEclipse installation program can be downloaded from its official website for free, address: http://www.eclipse.org in download select "Eclipse classic" to download, its latest version is 3.3.2. . The following is an example of Windows operating system to introduce eclipse installation. 2.2.2 install eclipseEclipse is a tool developed in Java language. Therefore, before installing eclipse, you must install JDK. eclipse3.3.2 requires that the installed JDK version be 1.5 or later. Eclipse installation is simple. You only need to decompress the installation file. There is no limit on the files to be decompressed. You can decompress the files to any path as needed. 2.2.3 basic use of eclipseAfter the eclipseinstallation is complete, select eclipse.exe under the eclipseinstallation directory to start the software. 2.2.3.1 workspace settingsWhen eclipse is started for the first time, a window titled "workspace launcher" will pop up. The function of this window is to set the workspace (workspace) of Eclipse ). Workspace refers to the default storage path and eclipse-related personalized settings of the content created by eclipse. In this window, the "workspace" input box is the path to be set. You can set it based on your needs, the following "use this as default and do not ask again" option means: use this option as the default setting. Do not ask again later. The selected option will take effect as follows: 1. This window is no longer displayed at next startup. 2. Use this setting as the default setting. If this option is not selected, this window is displayed at each startup. After setting, select "OK" to start eclipse. 2.2.3.2 display the main interfaceAfter eclipse is started for the first time, a welcome page will be displayed. Select "X" on the right of "welcome" in the upper left corner to close the welcome page, and you will see the main interface of Eclipse. The welcome page is displayed only once. It will only be displayed after the workspace is changed. The layout of the eclipse interface is not introduced here, because some technical terms to be learned are inevitable during the introduction. Here, we will briefly introduce how to use them, as for the layout of the interface, I am gradually getting familiar with it. 2.2.3.3 basic use of eclipseThe use of the integrated development environment (IDE) is relatively cumbersome, but it is very practical for actual project development. In the first use, you need to get used to and adapt to this use method. Before using the integrated development environment, you must first establish a project. A project is a management structure that manages all source code and resource files within a project, save the settings related to the project. A project can contain any number of source files and any number of resources. The basic steps for using eclipse are as follows: l create a project l create a source file l edit and save the source file l run the program 2.2.3.3.1 create a projectTo create a project, follow these steps: 1. Choose File> New> JAVA project. 2. In the new Java project window, set the project to be created, for example, if you enter test "Project Name", it indicates the project name and is converted into a folder name on the hard disk. "Content" sets the project content. In the "JRE" section, set the JDK version used by the project. The "project layout" section sets the directory structure inside the project file. 3. Select the "finish" button to complete the setting. After the project is created, you can view the structure of the project folder in the corresponding disk path. 2.2.3.3.2 create a source fileAfter the project is created, or after the project is opened, you can create a new source file. A project can contain multiple source files, and each source file can be executed independently. To create a source file, follow these steps: 1. Choose File> New> class. 2. In the new Java Class Wizard, set "source folder" to the new source file to represent the source code directory, for example, "test/src". If the content is consistent with the project, no modification is required, otherwise, you can select "Browse ..." Button. "Name" indicates the name of the source file. For example, enter hello. The "public static void main (string [] ARGs)" option indicates that the generated Source Code contains the code and this setting is selected. 3. Select the "finish" button to complete the settings. Eclipse automatically generates the required source code and opens it in the eclipse environment. The generated code is as follows: Public ClassHello {/*** @ ParamARGs */ Public Static VoidMain (string [] ARGs ){// TodoAuto-generated method stub }} 2.2.3.3.3 edit and save source filesYou can delete the comments used for description and add the code of the output string, which is changed to the following content: Public ClassHello { Public Static VoidMain (string [] ARGs) {system. Out. Println ("Hello world! ") ;}} Select the Save button on the toolbar or press Ctrl + S to save the source file. Eclipse automatically compiles the code when saving the source file. If a syntax error occurs, the prompt is in red. 2.2.3.3.4 run the programThe method for running the program is: select the blank source code, right-click, and choose "Run as"> "1 Java application" to run the program. Of course, you can also select the file name you need to run on the left side of Eclipse, right-click it, and find the same menu for running. In this way, the running result of the program is displayed on this interface.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.