Eclipse Getting Started (2)

zhaozj2021-02-16  63

Write a Hello World program

Below we write a HellWorld program, steps below: 1. Select File → New → Item; 2. Project categories selection Java; 3. The project list selection Java project; 4. Click "Next"; 5. Enter the project name, for example: helloproject; 6. Click "Finish"; 7. Click "Create Java Class" in the tool bar (with a C mark) as shown in Figure 1;

Figure 1 Click "Creating a Java Class" button to call

8. Enter helloWorld; 9 in the name domain; Click on the PUBLIC Static Void Main (String [] args) check box to create the main method (see Figure 2);

Figure 2 Eclipse creates a main method

10. Click "Finish"; 11. A Java editing window will open, enter the system.out.println ("Hello World") line in the main method; 12. Use Ctrl-S to save, which will automatically compile helloWorld.java; 13. Click the "Run" button in the toolbar; 14. Select "Java Application" and select "New"; 15. Enter the project name Hello-Project and Main class name HelloWorld; 16. Click "Run"; 17. At this time, a console window will be opened, and a "Hello World" will be displayed (see Figure 3).

Figure 3 "Hello World" Display Window

Eclipse has an incremental compiler that automatically compiles every time a Java file is saved. This feature is called "automatic build". If this feature is not required, you can perform automatic build on the window → preference → Workbench → to perform automatic build, turn off this feature. The "All Build" button will appear in the toolbar. Similar options will also appear in the relevant menu.

Create a CVS repository

Now we know how to create a project, the next step is to establish a connection with a version server, publish the project into the version server. At present, open source software uses CVS to make version management, so we also use CVS to exemplify. The Eclipse SDK has included a plug-in that supports CVS. To use other version management software, such as VSS, you can download related plugins from the Eclipse website. The steps to create a CVS repository location are as follows: 1. Open CVS Resource Library Development Perspective (Window → Open Perspective → Other → CVS Resource Library Development). 2. Right-click on the CVS repository view, create a new → repository location, see Figure 4.

Figure 4 New Resource Location

3. Enter the details of CVS Server in the Add CVS Resource Board dialog. 4. Click "Finish". 5. Once the CVS repository is configured, you can enter the project to enter the repository. Go to the Java perspective, right click on the project name, select the group → sharing item. 6. Select the repository that just added. 7. Click "Finish". 8. Right-click on the project in the synchronization window, choose the submission. 9. Enter a comment to submit to join, as shown in Figure 5.

Figure 5 is a submission to the comment

10. Click "OK", the project is released to the CVS repository.

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

New Post(0)