Debugging Java program code with eclipse

Source: Internet
Author: User
Tags resource

To create a Java project

When Eclipse first starts with a resource perspective, in which you can manage projects, folders, files, and other resources, as Eclipse says, these panels are called views, and a complete set of views is called a perspective, and in a resource perspective, You can use the top left view (Navigation view) to navigate and create resources.

Before doing things in eclipse, such as creating a Java program, you create a Java project, and the steps to create a Java project are as follows:

1, in the Navigation view right click on the pop-up context menu to select new Items;

2, in the New Project dialog box, Eclipse provides the project options: Java, plug-in development, and so on. So you want to create a Java project, select Java on the left side of the dialog box;

3, select the Java project on the right of the dialog box, if you also installed other Java Plug-in development package, here will be listed together (such as ejb,servlet, etc.), the Eclipse default installed JDT only support standard Java applications, so you must choose the Java Project option;

4, click Next to enter the New Project Wizard dialog box;

5, first give the project a name, because it is a simple "Hello, world" example, so here I enter "Hello", click Next, set up the Java Project setup options, for this project you do not need to make any changes;

6, click to complete;

7, eclipse will prompt you this project is associated with the Java perspective, and ask you whether to switch to the Java perspective, select Yes.

Creating Java Classes

When you've created a Java project, you can start creating Java programs, although it's not necessary to do this, it's a good practice to organize your Java classes into packages, usually using a domain name as a package name, so you can reduce the likelihood of a name conflict, and if you don't have a domain name, you can use either What convenient, unique name, I use org.eclipseguide here, the project name is Hello, so the full name of the package is Org.eclipseguide.hello.

Follow these steps to create a Java program:

1, on the project right click, select New.class pop-up Java Class Wizard;

2. The first field area "source folder" defaults to the folder of the item, keeping the default value;

3, input the Org.eclipseguide.hello in the Packet field area;

4, in the Class Name section area input HelloWorld;

5. In the "Which method stubs Would you like to Create" area, select public static void Main (string[] args), and the New Java Class dialog box is shown in Figure 1.

Figure 1 Creating a HelloWorld class using the New Java Class Wizard

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.