The eclipse java

Java SE

  • First, Editor
    • 1.eclipse use
    • 2. Debugging

First, Editor

Java syntax is very similar to C, where the first use of a few very simple program to point to distinguish the difference between C and Java and then go into detail each knowledge point.

  1. Create a Java project by eclipse
  1. Double-click to open the eclipse, click on the menu bar File, the pop-up drop-down menu New, select in the menu on the rightJava Project
  2. Fill in the project name in the Project name location, click on the Finishbutton to complete
  3. Then we just created into the project to find a good Java srcfile folder, right in the pop-up menu, select New, then click on the rightClass
  4. In the box that pops up to find Package Enter the package name, enter the name of the Java class file in the Name, and then check belowPublic static void main(String[] args)
  5. Finally, click on the Finishbutton to complete
    our previous code again hello world output again by editor
// define a HelloWorld class name 
public   class HelloWorld {
     // define a main method, a program entry 
    public  static  void  public  static  void main (String [] args) {
         // information output to the console and newline characters 
        System.out. println ( "the Hello World!" ); 
    } 

}

 

Right after we write Java file, find the Run asstart of the current run Java files, found in the bottom of the window eclipse Consoletab, you can view the contents of the Java program output

Console console that is

1.eclipse use

View Project Location

  1. Right on the project to find properties, click to open the Properties window, select the first item on the left
  2. Location found on the right side, shown here is the current project storage location

Reset Window Layout

  1. In the menu bar click Window items found Perspective, click Rest Perspective
  2. Or click on the Edit button to adjust the upper right corner of Java EE is

Display window

  • Also click on the Window item, find Show View, select the window you need at the right side of the pop-up menu, for example: Servers

Set the font

  1. Click Window item, find the last preferences, select General> Appearance> Colors and Fonts on the left.
  2. Select Java> Java Editor Text Font in the right window, click on the right Editbutton to change the font color and size

As an example in other languages

Modify the console font

  • The method steps above, starting from step 2 to find the right window Debug> Console font (or search bar at the top right of direct input cons), the same click on the right Editbutton to change

Project import and save

>

  1. In the left navigation bar space project, right-click on the pop-up menu Import items found
  2. 选择General>Existing Projects into Workspace
  3. In the Select root Directory Enter the location of your project
  4. Projects in check the items you want to import
  5. Check below Copy project into workspace
  6. Finally, click Finish to complete

Modify keyboard shortcuts

  1. Also open preferences, directly to the left of the search bar above the input keys
  2. In the right of the search cont, find Content Assist
  3. To change the input keys in the bottom of the Binding
  4. Finally, click ok on it

Heavy naming

  • Right-file needs to change the name of the file or folder, find the Refactor> Rename, enter the name change can click ok

Setting coding

  • Window> Preferences >> General> Workspace> Text file encoding> other
    is at the bottom of the window, select Change

    Unicode Unicode
    UTF-8
    gb-2312
    big5

Local JavaDOC API set the JDK path and source path

  • Window> Preferences> Java> Installed JREs, select the Set a good jre directory, and then select all JRE system libraries under all packages, click on the right Source Attachment;
  • Under External location, select the JDK installation directory forehead src.zip file, click ok to complete
Ctrl+1 快速修复(最经典的快捷键)
Ctrl+D: 删除当前行
Ctrl+Alt+↓ 复制当前行到下一行(复制增加)
Ctrl+Alt+↑ 复制当前行到上一行(复制增加)
Alt+↓ 当前行和下面一行交互位置(特别实用,可以省去先剪切,再粘贴了)
Alt+↑ 当前行和上面一行交互位置(同上)
Alt+← 前一个编辑的页面
Alt+→ 下一个编辑的页面(当然是针对上面那条来说了)
Alt+Enter 显示当前选择资源(工程,or 文件 or文件)的属性
Shift+Enter 在当前行的下一行插入空行(这时鼠标可以在当前行的任一位置,不一定是最后)
Shift+Ctrl+Enter 在当前行插入空行(原理同上条)
Ctrl+Q 定位到最后编辑的地方
Ctrl+L 定位在某行 (对于程序超过100的人就有福音了)
Ctrl+M 最大化当前的Edit或View (再按则反之)
Ctrl+/ 注释当前行,再按则取消注释
Ctrl+O 快速显示 OutLine
Ctrl+T 快速显示当前类的继承结构
Ctrl+W 关闭当前Editer
Ctrl+K 参照选中的Word快速定位到下一个
Ctrl+E 快速显示当前Editer的下拉列表(如果当前页面没有显示的用黑体表示)
Ctrl+/(小键盘) 折叠当前类中的所有代码
Ctrl+×(小键盘) 展开当前类中的所有代码
Ctrl+Space 代码助手完成一些代码的插入(但一般和输入法有冲突,可以修改输入法的热键,也可以暂用Alt+/来代替)
Ctrl+Shift+E 显示管理当前打开的所有的View的管理器(可以选择关闭,激活等操作)
Ctrl+J 正向增量查找(按下Ctrl+J后,你所输入的每个字母编辑器都提供快速匹配定位到某个单词,如果没有,则在stutes line中显示没有找到了,查一个单词时,特别实用,这个功能Idea两年前就有了)
Ctrl+Shift+J 反向增量查找(和上条相同,只不过是从后往前查)
Ctrl+Shift+F4 关闭所有打开的Editer
Ctrl+Shift+X 把当前选中的文本全部变为小写
Ctrl+Shift+Y 把当前选中的文本全部变为小写
Ctrl+Shift+F 格式化当前代码
Ctrl+Shift+P 定位到对于的匹配符(譬如{}) (从前面定位后面时,光标要在匹配符里面,后面到前面,则反之)
下面的快捷键是重构里面常用的,本人就自己喜欢且常用的整理一下(注:一般重构的快捷键都是Alt+Shift开头的了)
Alt+Shift+R 重命名 (是我自己最爱用的一个了,尤其是变量和类的Rename,比手工方法能节省很多劳动力)
Alt+Shift+M 抽取方法 (这是重构里面最常用的方法之一了,尤其是对一大堆泥团代码有用)
Alt+Shift+C 修改函数结构(比较实用,有N个函数调用了这个方法,修改一次搞定)
Alt+Shift+L 抽取本地变量( 可以直接把一些魔法数字和字符串抽取成一个变量,尤其是多处调用的时候)
Alt+Shift+F 把Class中的local变量变为field变量 (比较实用的功能)
Alt+Shift+I 合并变量(可能这样说有点不妥Inline)
Alt+Shift+V 移动函数和变量(不怎么常用)
Alt+Shift+Z 重构的后悔药(Undo)

2. Debugging

1. Double-click a breakpoint setting or cancel code before

When the program runs guide this position, it will break, waiting for your next step

2. Start Debugging

Click on the toolbar button to start the debugger debug

Selection switching view may be

3. perform debugging

  • Normal execution
  • Single-step execution
  • Step Over

Guess you like

Origin www.cnblogs.com/bomily0212/p/12058292.html