Java JDK和IntelliJ IDEA 配置及安裝

序言

初學java,idea走一波先。安裝完成,配置配置項.java

idea 軟件

官方下載地址:https://www.jetbrains.com/idea/download/#section=windows git

我盤裏面的,時間久啦就老啦。忽略。windows

版本intellij-idea

IntelliJ IDEA 2019.1.3 (Ultimate Edition)
Build #IU-191.7479.19, built on May 28, 2019
Licensed to jetbrains js
Subscription is active until November 27, 2019
JRE: 1.8.0_202-release-1483-b58 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0app

連接:https://pan.baidu.com/s/1Oy1Pr_XrMybEg8WmYtLjaA
提取碼:7nvg ide

jdk環境變量

Path:      C:\Program Files\Java\jdk1.8.0_162\bin
CLASSPATH:   C:\Program Files\Java\jdk1.8.0_162\lib
JAVA_HOME   C:\Program Files\Java\jdk1.8.0_162svn

Code templates

1.idea設置:File->Settings->Editor->File and Code Templates工具

選中Includes標籤:選中File Header,修改成 開發工具

/**
* @author ${USER} 
* @date ${DATE} ${TIME}
*/ 字體

修改Files,依次編輯Class,Interface,Enum等經常使用java類型,修改成

/*
* Copyright ${YEAR} tu.cn All right reserved. This software is the
* confidential and proprietary information of tu.cn ("Confidential
* Information"). You shall not disclose such Confidential Information and shall
* use it only in accordance with the terms of the license agreement you entered
* into with Tu.cn
*/
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end
#parse("File Header.java")
public class ${NAME} {
}

Code Formatter

1.2 idea下請先裝Eclipse Code Formatter的插件, 設置: File->Settings->Other Settings->Eclipse Code Formatter->Eclipse Java Formatter config file->導入文件
1.3 idea若是遇到裝不了插件的狀況, 設置: File->Settings->Appearance&Behavior->System Settings->Updates->將Use secure connection勾選去掉

模板地址

連接:https://pan.baidu.com/s/1rvhj0oW_SM8xnIyuOhQ_oQ
提取碼:f54k

取消大小寫敏感

file->Settings->Editor->General->Code Complention->Match case 勾去掉

隱藏開發工具的配置目錄 例如 .idea;.iml

file->Settings->Editor->File Types->ignore file and folders 結尾添加 .idea;*.iml

收起註釋,讓源碼閱讀更爲清爽!

File -> Settings -> Editor -> General -> Code Folding -> Documentation comments 勾選。

快速打開/關閉全部文檔註釋

右鍵->Folding->Expand All/Collapse All

快速文檔註釋

alt+enter- >Add Javadoc

自動編譯

敲擊 Ctrl + Shift + Alt + / 而後雙擊Shift搜索進入Registry ,找到compiler.automake.allow.when.app.running ,而後勾選上。(運行期間自動編譯設置)。

https://www.jianshu.com/p/f658fed35786

自動導包和智能移除 

File -> Settings -> Editor -> General ->Auto Import

1.add unambiguous imports on the fly //自動導入依賴

2.optimize imports on the fly(for current project) //優化導入和只能刪除勿關依賴

使用 Alt + Enter 進行導入包.

Insert imports on paste:複製代碼的時候,對於導入的包是否須要進行詢問的一個選項。
         ASK(有須要導入的包名時會彈提示框,問你要不要導入)
         NONE(有須要導入的包名時不會彈提示框,也不會自動導入)
         ALL(有須要導入的包名時會自動導入,不會彈提示框)
Show import popup:當輸入的類的聲明沒被導入時,會彈出一個選擇的對話框
Optimize imports on fly:自動優化包導入,移除不須要的包
Add unambiguous imports on the fly:這個就是自動導入功能了,當你輸入類名後聲明就被自動導入了
Exclude from Import and Completion:這個其實就是你自定義import,能夠不用關注,通常來講你是用不上

版本控制

idea會自動識別,本身也看下對不對嘛。

file->version control->git

path to git executable : git.exe 絕對路徑 c:\program files\git\cmd\git.exe

左側項目顯示類方法

內存使用量展現

file->setting->appearance & behaivier -> show memory indicator

懸浮提示

File-->Settings-->Editor-->General-->show quick documenttion on mouse move 勾選

有時候在看代碼的時候,不清楚一個類具體是幹什麼的,就會點進去看這個類的註釋,可是強大的IDEA是支持不用點進去就能夠看到註釋的以及類的相關信息的。可是須要手動打開

Ctrl+鼠標滾軸修改字體大小

File-->Settings-->Editor-->General-->change font size(Zoom) with Ctrl+Mouse Wheel 勾選

 

顯示多行Tab

File-->Settings-->Editor-->General-->Editor tabs

1.去掉 show tabls in one row

2.tab limits 增長爲20個。

顯示行號,顯示svn/git最近提交人

在編輯區直接操做,能看到每一行代碼的最近一次修改人,以及提交記錄信息。這樣每行代碼都有記錄。能很快定位到誰動過代碼,而後找到指定的人來解決問題。

查看文件的本地歷史記錄

鼠標選中文件,而後右鍵,在彈出的列表中選擇Local History而後就能夠看到文件的本地修改記錄,即便沒有版本控制工具也能夠看到這些記錄。 

全局JDK配置

File ->Other Settins -> Project Structure for New projects-> Project 

關閉Intellij IDEA自動更新

File->Settings->Appearance & Behavior->System Settings->Updates下取消Automatically check updates for勾選 

文件編碼設置

File->Settings->Editor->File Encodings

推薦設置:

Global Encoding:UTF-8
Projectt Encoding:UTF-8
Default encoding for properties files:UTF-8
勾選上Transparent native-to-ascii conversion
Transparent native-to-ascii conversion屬性主要用於轉換ascii,否則Properties文件的中文會被轉碼,IntelliJ IDEA除了支持對整個Project設置編碼以外,還支持對目錄、文件進行編碼設置。若是你要對目錄進行編碼設置的話,可能會出現須要Convert編碼的彈出操做選擇,強烈建議在轉換以前作好文件備份,否則可能出現轉換過程變成亂碼,沒法還原。對單獨文件的編碼修改還能夠點擊右下角的編碼設置區,若是代碼內容中包含中文,則會彈出演示中的操做選擇,Reload 表示使用新編碼從新加載,新編碼不會保存到文件中,從新打開此文件,舊編碼是什麼依舊仍是什麼,Convert 表示使用新編碼進行轉換,新編碼會保存到文件中,從新打開此文件,新編碼是什麼則是什麼。

提示選中補全代碼(Enter/空格,逗號等)

File->Settings->Editor->General-->Code Comepletion -> insert selected suggestion by pressing space,dot,or other context-dependent keys 勾選上。

方法未引用檢查去掉

Setting-->editor-->inspections-->unused declaration-->methods 去掉

總結

用着更新着吧

相關文章
相關標籤/搜索