Getting Started with Java (Prerequisite) - Integrated Development Environment IDE

Getting Started with Java (Prerequisite) - Integrated Development Environment IDE

Integrated Development Environment (IDE) for Java

       - The integrated development environment emphasizes one-stop development, just use this tool. It has prompt function and automatic error correction function.
       - Integrated development environments can make software development simpler and more efficient.
       * Advantages :
            - No need to install JDK independently [already integrated in IDE]
            - No need to manually configure environment variables
            - No need to use the javac command to compile java source files
            - And syntax errors in iava source program writing will be prompted immediately
            - Use IDB tools A lot of code does not need to be written, it is automatically generated.
       * Common java IDEs :
           - eclipse
           - myeclipse
           - Intellij IDEA
           - NetBeans
           ...

How to link source code

      Open a certain .class bytecode file, and when you do not see the source code: click "Attached Source":
         - Workspace.. [The source code is in the current workspace]
         - External File.. [The source code is in a compressed package]
         - External Folder..[The source code is in a certain directory]
 - Try to link the source code again
 - Shortcut key for importing classes: ctrl+shift+c

package mechanism

      - Also called package, in order to facilitate program management and maintenance

 Package naming convention

           - All lowercase letters are required. The package name is also an identifier and follows the identifier rules.
           - A package will correspond to a directory in the future.

Naming rules

                * Individual:
                     * indi: Completed by multiple people, the copyright belongs to the initiator
                            indi. Initiator name. Project name. Module name *.*.*
                     * pers: Completed alone, public, the copyright mainly belongs to the individual
                            pers. Personal name. Project name. Module name *.*.*
                     * priv: Completed alone, non-public, copyright belongs to the individual
                            priv. Personal name. Project name. Module name *.*.* *
                Team:
                     * team: Initiated by the team, the copyright belongs to the team
                            . Team name. Project name. Module name *.*.*
                * Company:
                     * com: Initiated by the company, the copyright belongs to the company
                            . com. Company name. Project name. Module name *.*.*

How the package mechanism works

           - The class name is changed to: package name.original class name.
           * Another method:
                - Compile: java -d The path to store the java source file after compilation
                       eg: java -d . *.java (compile *.java in the current path and store it in the current directory)
                - Run: JVM The class loader loads from the current path by default. You need to switch the DOS command window to the current path.

Commonly used shortcut keys in eclipse

shortcut key Function
compile

Ctrl + 1

quick fix

Ctrl + Shift + F

Format current code

Ctrl + Shift + M

Add the import import of the class

Ctrl + Shift + O

Organization class import (it has the function of Ctrl+Shift+M, and can help you remove useless imports, very useful)

Ctrl + Y

Redo (opposite of Undo Ctrl+Z)

Alt + /

Content assistance (how many keyboard strokes it saves you, it’s so commonly used)

Ctrl + D            

Delete the current line or multiple lines

 Alt + ↓      

The interactive position between the current line and the following line (especially practical, you can save the need to cut and paste first)

 Alt + ↑      

The interactive position between the current line and the previous line (same as above)

Ctrl + Alt + ↓

Copy the current line to the next line (copy increment)

 Ctrl + Alt + ↑

Copy the current line to the previous line (copy increment)

 Shift + Enter     

Insert a blank line next to the current line (at this time, the mouse can be at any position of the current line, not necessarily at the end)

 Ctrl + /

  Comment the current line, press again to cancel the comment

choose

                    

 Alt + Shift + ↑

Select encapsulated elements

 Alt + Shift + ←

Select previous element

 Alt + Shift + →

Select next element

 Shift + ←

Select characters starting from the cursor and moving to the left

 Shift + →

Select characters starting from the cursor and moving to the right

 Ctrl + Shift + ←

Select the word to the left of the cursor

 Ctrl + Shift + →

Select the word to the right of the cursor

move

                    

 Ctrl + ←

Move the cursor to the beginning of the word on the left, which is equivalent to vim's b

 Ctrl + →

The cursor moves to the end of the word on the right, which is equivalent to vim's e

search

                    

 Ctrl + K           

Refer to the selected word to quickly locate the next one (if no word is selected, search for the last word used to search)

 Ctrl + Shift + K

Quickly navigate to the previous one by referring to the selected Word

 Ctrl + J

Forward incremental search (after pressing Ctrl+J, the editor will provide a quick match for each letter you enter to locate a certain word. If not, it will display in the status bar that it is not found. When searching for a word, Especially practical, to exit this mode, press escape)

 Ctrl + Shift + J

Reverse incremental search (same as the previous article, except that it searches from back to front)

 Ctrl + Shift + U

List all lines containing string

 Ctrl + H

Open search dialog

 Ctrl + G

Statement in workspace

 Ctrl + Shift + G

References in workspace

navigation

                    

  Ctrl + Shift + T

搜索类(包括工程和关联的第三jar包)

 Ctrl + Shift + R

搜索工程中的文件

 Ctrl + E

快速显示当前Editer的下拉列表(如果当前页面没有显示的用黑体表示)

  F4

打开类型层次结构

  F3

跳转到声明处

 Alt + ←           

前一个编辑的页面

 Alt + →

下一个编辑的页面(当然是针对上面那条来说了)

 Ctrl + PageUp/PageDown

wn在编辑器中,切换已经打开的文件

调试

                    

 F5

单步跳入

 F6

单步跳过

 F7

单步返回

 F8

继续

 Ctrl + Shift + D

显示变量的值

 Ctrl + Shift + B  

 Ctrl + R

运行至行(超好用,可以节省好多的断点)

重构

                    

 Alt + Shift + R

重命名方法名、属性或者变量名(是我自己最爱用的一个了,尤其是变量和类的Rename,比手工方法能节省很多劳动力)

 Alt + Shift + M

把一段函数内的代码抽取成方法(这是重构里面最常用的方法之一了,尤其是对一大堆泥团代码有用)

 Alt + Shift + C

修改函数结构(比较实用,有N个函数调用了这个方法,修改一次搞定)

 Alt + Shift + L

抽取本地变量(可以直接把一些魔法数字和字符串抽取成一个变量,尤其是多处调用的时候)

 Alt + Shift + F   

 Alt + Shift + I

合并变量(可能这样说有点不妥Inline)

 Alt + Shift + V

移动函数和变量(不怎么常用)

 Alt + Shift + Z

重构的后悔药(Undo)

其他

                    

 Alt + Enter

显示当前选择资源的属性,windows下的查看文件的属性就是这个快捷键,通常用来查看文件在windows中的实际路径

 Ctrl + ↑

文本编辑器上滚行

 Ctrl + ↓

文本编辑器下滚行

 Ctrl + M

最大化当前的Edit或View(再按则反之)

 Ctrl + O

快速显示OutLine(不开Outline窗口的同学,这个快捷键是必不可少的)

 Ctrl + T

快速显示当前类的继承结构

 Ctrl + W

关闭当前Editer(windows下关闭打开的对话框也是这个,还有qq、旺旺、浏览器等都是)

 Ctrl + L

文本编辑器转至行

 F2

显示工具提示描述

Guess you like

Origin blog.csdn.net/qq_61562251/article/details/135046833