Java Learning does not detour tutorial (7.Eclipse Environment Building)

Source: Internet
Author: User

7.Eclipse Environment Construction

In the first few chapters, we are familiar with the DOS environment to compile and run Java programs, for large-scale programming, development tools are essential.
Java's development tools are more commonly used by eclipse. In the next tutorial, we will write, compile, and run the program based on the Eclipse development tools.

This chapter describes the installation and basic operations of Eclipse.
1.Eclipse installation and start-up
and installation of ordinary Windows programs, download from the official website after the installation can not be described in detail here.
I'm installing Eclipse OXYGEN.
After the installation is complete, there is a file in the installation directory: Eclipse.exe and Eclipse.ini
The startup parameters are configured in Eclipse.ini, including the amount of memory occupied.
Double-click Eclipse.exe to start eclipse

When you start eclipse, you will be prompted to select the workspace interface and enter your own workspace directory, such as (C:\workspace).
If you have more than one workspace, you can select File/swich workspace to switch the workspace after the boot is complete.

After Eclipse is successfully launched, the Welcome screen appears and is closed directly.

2. Compile/Run environment
In order to compile and run the Java program properly, we need to specify the path to the JDK in eclipse.

menu, select Window->preferences, pop-up property interface.

In the Properties interface, select Java->installed JREs, and the right window displays the JDK selection interface.
Click Add.

Select the standard VM and click Next to pop up the add JDK interface.

Click Directory to select the path to the JDK, as shown in:

Click Finish, tick the added JDK, and click Apply and Close to complete the JDK settings.

3. New Java Project
After the JDK is set up, let's run a simple Java program.
First, create a new Java project.

Menu Bar Select File->new->java Project

Pop-up window, enter project name, workspace default, click Finish, complete the new Java project.

Then, we create a new package.
Right-click on src new->package

In the popup window, enter the package name and click Finish.

Under the new package, create a new Java file.
Right-click on the new package name New->class

In the popup window, enter the class name, and tick public static void main, as shown in:

This allows us to create a Java file that contains the main method portal.
Let's enter a line of code as shown:

The program outputs the two parameter values passed in.

4. Running
Right click on the written Java program and choose Run as->run configurations.
Note: If you do not need to read any parameters, select Run As->java application.

On the pop-up window, select Java application and click the new icon in the upper left corner.

The system automatically creates a run setting for the class name.
Select the class name, and on the Right tab interface, select the Arguments tab and go to the Run parameter Settings screen.

In the Arguments tab, enter the parameter values you want to set, separate them with a space, and then click Run to execute the program.

Output the running results of the program in the Console tab.

5. Project configuration
Let's take a look at the actual location of the new Java file and the compiled class file:
At the root of the project, there are src and bin directories, where the SRC directory holds the source file, and the bin directory stores the cheap and good files.

The source files of the SRC directory are as follows:

The post-compilation file for the bin directory is as follows:

The above location information can be specified in the following interface:
Right-click the project name and select Properties.

In the popup screen, select Java Build Path,
The Source tab on the right shows the directory where the sources are located and the directory where the compiled files are located.

Project tab Other projects that are referenced by this project.

The Libraries tab allows you to set the class files required for the project compilation.

The Order and Export tab allows you to set the compilation sequence for the project


6. Automatic compilation and manual compilation
After eclipse is installed, it is automatically compiled by default, that is, the source file is saved and automatically compiled into a class file.
This setting can be modified in project->build automatically,
As shown
Note: Clean clears the files that are generated after compilation.

If you do not tick build automatically, you will need to manually start the compilation process,
Right-click the project name and select Build project to start compiling the project.

Copyright Notice: This tutorial copyright belongs to JAVA123.VIP All, prohibit any kind of reprint and reference.

Original Posted in: http://www.cnblogs.com/java123vip/p/8999150.html

Java Learning does not detour tutorial (7.Eclipse Environment Building)

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.