Java basics: Lecture 8 using the integrated development environment (I)

Source: Internet
Author: User
Tags manual writing

 

Here, we select the eclipse integrated development environment, and a eclipse-based plug-in will be selected when developing Web applications. For convenience, we select myeclipse. Note: The functions provided by myeclipse are not used when introducing Java basics. My integrated development environment: myeclipse 7.5. The installation process is not described. For Java applications, the important functions of using the integrated development environment are as follows: n creating a project, managing a project, N compiling a file, N compiling a file, and n running a program. The following describes the order in which the application appears. Set a workspaceTo create a project, you must first select the location where the project file is stored, that is, the workspace ). When myeclipse is started, the system prompts you to select a workspace and select a directory. For convenience, you can create a workspace for each project. You can switch to another workspace if it has been started. The switch operation is as follows: [file] à [Switch workspace] à [other], and then select the corresponding location. Select perspective and viewPerspective indicates a work view, such as the Java application view, web development view, debug view, and resource view. Each view contains different small windows. Small windows are called views. To select a view, you can click WINDOW> open perspective to select a view or other. You can also select a view from the toolbar on the right of the window. Java perspective is usually used to develop Java applications. Java perspective consists of three parts: package on the left of N: all folders, all classes, all member variables and member methods in the project can be seen. N intermediate code area: shows the code. Java code is displayed in this area. Multiple files can be displayed and switched between multiple files. N in the console area: displays the running results and error messages during compilation. Note: You can drag to change the location of the region. In a certain view, you can select a view, click WINDOW> open view, and select a window. If you accidentally close a window, you can open it again in this way. In addition, you can double-click the border above a window to maximize the current window. For example, you can maximize the code area when writing code. Suggestion: click a perspective to view the layout. Create a projectTo create a project and develop a Java application in eclipse, you must first create a project. The process of creating a project is as follows: Right-click the blank space in the left package window and choose new> JAVA project ], alternatively, select Java project> New> JAVA project. The project creation page is displayed. Enter the project name hello, click Next, or complete. The default settings are used here. You can also set them separately. You can do this at the beginning without making any changes. By default, another Src folder is used to store source files. during compilation, all files under SRC are compiled. Create packageRight-click SRC, choose new> package, and enter the package name on the pop-up page. Enter "packages" here ". You can also create a package when creating a class. Create classRight-click a package, select new> class, select the package (the package clicked with the mouse is selected by default), and enter the class name, if you want to generate the main method, select the corresponding check box. In this way, a hello. Java class is generated and displayed in the code area. Writing ClassYou can double-click hello. Java in the code area to edit it. Add the following code to the main method: system. Out. println ("Hello world! "); This program is the same as the first one we wrote manually. Note: You should not copy the data here, but input the data to see what services the integrated development environment provides for us during the input process. If the code is written incorrectly, red marks are displayed on the left and right sides of the wrong code line. Place the cursor over the red icon on the left to view the error message prompted by the system. You can modify the code according to the error message. You can intentionally write an error in the code to see the effect. RunDuring the previous manual writing, we need to compile before running. Now we can run it directly and integrate the development environment for automatic compilation. To run the program, right-click the code to be executed and choose run as à Java application ]. The running result is displayed in the window. If an error occurs, the error message is displayed in the following window. The use of the integrated development environment has some other aspects, which are not suitable for the current introduction. Therefore, it is called "using the integrated development environment (on )", after introducing the basic java syntax, we will introduce other usage of the integrated development environment. Last Lecture: 7. Compile and run Java programs Next Lecture: Basic Information Representation in lecture 9You can use the environment. Li xucheng Csdn blog : Http://blog.csdn.net/javaeeteacher Add as a friend: Http://student.csdn.net/invite.php? U= 124362 & C = 7be8ba2b6f3b6cc5

 

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.