Basic usage of Eclipse

Source: Internet
Author: User


Basic use of Eclipse------------------------------------------------
The workspace is actually the directory where we write the source code.
Use Eclipse to complete a HelloWorld case
Code with project as base unit
1. Create a project
2. Create a Package
3. Create a class
4. Writing code

The project name is generally lowercase, for example: Eclipse_text
SRC: Source package, source folder, so the code is put here to make sense

Build a package: for example, cn.itcast_01


Compile: Automatic compilation, at the moment of saving to help you do it

Run:
Click the green Inner triangle button behind the worm
Click Run under the Run menu, or you can use the shortcut key ctrl+f11
Select the file you want to run or right-click the--run as--java application in the file you want to run


Installing plug-ins with Dropins
Starting from Eclipse3.5, the installation directory is more than a dropins directory, as long as the plug-in decompression into the directory can, similarly, this way to uninstall plug-ins is also particularly convenient, recommended this way

Source code Syntax Check
Red wavy Line Syntax error
Yellow wavy Line Warning

Windows each basic form is called a window
Packageexplorer display project structure, packages, classes, and resources
Outline display the structure of the class, easy to find, identify, modify
The result of the Console program running is displayed in this window
Problems display so the syntax and the location of the error
Hierarchy show Java inheritance hierarchy, right-click on the class file
Views have a combination of some windows
Java view
Debug view


Basic configuration of Eclipse space
1. Program compilation and operation of the environment configuration (generally do not change)
Window--preferences--java
Compile environment Compiler The highest version is selected by default
Operating environment: Installed JREs will find the JDK you installed by default
Problem:
Low build, high run, can
High compile, low run, not can
Recommended, compile and run the same version
2. How do I get rid of default annotations?
Window--preferences--java--code style--code Templates
Select what you don't want, and delete it by editing the right edit
Note: Please delete only the comment section, not the part of the comment.

3. Display and hiding of line numbers
Display: In the left-most blank area of the code area, right---show line number
4. Font size and color
The font size and color of the 1.java code area
Window-preferences-general-apperance-colors and Fonts--java Modify--java Edit text
2. Console
Window-preferences-general-apperance-colors and Fonts--debug--console Font
3. Other documents
Window-preferences-general-apperance-colors and Fonts-basic-text Font

5. What if the form is messed up?
Window--reset Perspective
6. What to do if the console is not found?
Window--show View-console

alt+/Content Secondary Key:
1.main method
main+alt+/Enter
2. Output statements
syso+alt+/
3. Prompt action
Help you with something you can't remember,

Common shortcut keys
1. Formatting ctrl+shift+f
2. Import Package Ctrl+shift+o
If the class is in only one package, it shows itself
If the class is in more than one package, a box will pop up for you to choose
3. Notes
Single line: Comment ctrl+/uncomment again.
Multiple lines: ctrl+shift+/,ctrl+shift+\
4. Move the code up and down
Select Code ALT + up/down arrow
5. View Source code
Check the class name (Ctrl + mouse click or F3)

Improve development efficiency:
1. Help us to provide the construction method automatically
A. Non-parametric construction method
In the code area right-click-source-generate Constructors Form Superclass
B. Construction method with parameters
Right-click-source-generate constructors using fields in the code area

2. Paired getxxx () and setxxx ()

In the code area, right--soure-generate Getters and Setters, and select all


Simplification tips:
When inheriting an abstract class, or implementing an interface, at this point we can select the specified parent class when creating a new class, for example, to create an inherited class and implement such an interface, you can also manually select to avoid handwriting code

Tip Two: See where the notes are, @override say what it is, what it's for
Indicates that this is a method of overriding the parent class

----Jar Package and Description document-----------------------------------------
Sometimes when we're doing a project, we need to import something from another project, then we have to hit the jar with the project we need, and then we'll bring the jar package into the project we need.

What is a jar?
Jar is a compressed package of multiple class files
What's the use of jars?
Use what someone else has written.
Hit Jar bag
Select the item, right--export-java-jar-yourself to specify a path and a name-finish
Using JAR Packages
Copy to the project path and add to the build path
Copy-open Project-ctrl V, there will be more than one jar suffix file, in the file right-click-build path-add to Build path, at this time a package, referenced Libraries


Jar Package general and manual use, light to a jar package, how do I know what is inside, so we have to learn how to make a manual, select the project-right--export--java-javadoc--Select a path-finish-open folder, Open the index file to view

-----How to delete a project and import a project----------------------------
Delete Item
Select Items-Right-click Delete-delete
1. Remove from the project area
2. Remove from the hard drive
Import Project
Right-click in the project area to find the import
Find general, expand, and find Existing Projects into Workspace
Click Next, then select the item you want to import
Note: The project name is selected here

A few common minor problems in eclipse------------------------------
How to view the path of a project
Check-right-click-properties-resource-location
Issues to be aware of when importing projects
Items with the same name cannot appear in the project area
Self-created folder can not be imported as a project (it is a configuration file, you do not have any documents, what guide)

Modify Project Issues
Do not arbitrarily modify the project name
If you really want to modify it, don't forget the configuration file. < in project modify the project name here >

Advanced (Debug) debugging of code in Eclipse--------------------
The role of debug
Debug program
View program Execution Flow
How to view the program execution process-----------------------
To see the program flow, you must set a breakpoint
What is a breakpoint
is a marker, where to start
How to set breakpoints
Where you want to see the program, you just double-click on the left side of the active program
Where to set breakpoints
Where's the point?
Currently: We add the first valid statement for each method
How to run a program that sets breakpoints
Right-click-debug As-java Applicaiton

See which places:
Debug: Where to test breakpoints
In this place, press F6 or click the button can also, at a time to see the execution of a line of the process
Variables: Viewing variable variations of a program
Fordemo: The source file being viewed
Console: Consoles
How to go to breakpoints:
Double-click again to
Find the debug view, variables interface, find breakpoints, and click, then see all the breakpoints, and finally click on that double fork

Basic usage of Eclipse

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.