Learn to use Eclipse to write Java programs

Source: Internet
Author: User

This article explains the process of writing a HelloWorld program in Eclipse.

Students who have just learned Java may write Java source code in Notepad, and finish compiling and running the Java program at the command prompt. Such a method is really enough to learn the basics of Java and it is the only way to understand Java better. Now the author introduces Java's most commonly used IDE tool eclipse, using Eclipse, writing, compiling, running, etc. can be done on a platform, it can even automate the production of code, comments and have a powerful error-checking function, in short, Java people will almost use this software.

Tools/Materials
    • People version of Eclipse
Method/Step
  1. Qi Gong Eclipse.

    Eclipse is a green version without the need to install, after downloading the direct decompression (if the decompression process error, you can install other decompression software to try). , double-click the Eclipse.exe folder under the decompression, the software startup will be a bit long, the first launch will pop up the selection Workspace dialog box, this is to choose the directory you want to put the code to put the box below the tick, the next boot will not pop up.

  2. New project.

    1 shows the Open New Java Project dialog box, 2, fill in the project name in the dialog box, other default, then click the Finish button to complete the new project.

  3. Create a new class.

    Before we create a new class we can actually create a new package, which I skipped. 1, in the project right-click, select the New Class menu, 2, in the dialog box to fill in the class name, note the following automatic production of the main function of the tick, the other default.

  4. Code writing.

    The third one will produce the code shown in 1, and then add your own code in the original code. The code shown in Figure 2 is:

    public class HelloWorld {

    /**

    * @param args

    */

    public static void Main (string[] args) {

    TODO auto-generated Method Stub

    System.out.println ("Hello world!");

    }

    }

  5. Program to run.

    As shown in Eclipse, compile run as soon as you click on the Run button, below is the console, type we used before the command prompt. The input and output are here. If there is a compile error message, click on the error message code, the cursor will be positioned to the corresponding error code line.

  6. Error handling.

    In the fifth step, if a compile error message appears, you can click the error message as shown in Figure 1, and the software will automatically navigate to the error line. If the edit area prompts you for an error, you can put the mouse on the error prompt as shown in Figure 2, and a list of error explanations and quick processing methods will pop up.

Learn to use Eclipse to write Java programs

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.