快捷键:html
File –> Settings -> KeyMap: 代码自动补全快捷键: 1)在右边的搜索框中输入:Cyclic Expand Word 在Cyclic Expand Word上右键->移除原来Cycle Expand Word的快捷键(Alt+正斜杠)绑定。 2)在右边的搜索框中输入:Basic 在Basic上右键->移除原来Basic的快捷键(Ctrl+空格)绑定->绑定新的快捷键(Alt + 斜杠)。 Suggest时,忽略大小写: File --> setting --> 搜索:sensitive --> 将右侧的 case sensitive completion 选项从First letter 改成 NONE。 关闭页面快捷键: 1)在右边的搜索框中输入:close active tab 在Close Active Tab上右键->移除原来的快捷键(Ctrl+w)绑定。 2)在右边的搜索框中输入:close 在Close上右键->移除原来的快捷键(Ctrl+F4)绑定->绑定新的快捷键(Ctrl+w); 自动生成局部变量快捷键: 1)在右边的搜索框中输入:Variable 在Variable上右键->添加新的快捷键(Ctrl+1)便可。 查找并替换快捷键: 1)在右边的搜索框中输入:replace Main menu | Edit | Find | Replace in Path...上右键->添加新的快捷键(Ctrl+r)便可。 控制台没有搜索快捷键: 1)在右边的搜索框中输入:find Main menu --> Edit --> Find --> Find...(光标悬浮在左边的放大镜上时出现:a string in active editor) 在Find...上右键->绑定新的快捷键(Ctrl+F)。 标准输出快捷键:sout至关于eclipse中的syso 全局搜索快捷键:ctrl+H 添加try/catch的快捷键:ctrl+alt+t 忽略 方法的注释中的参数 与 方法的实际参数 不一致的检查 1)在setting中搜索:inspection javadoc 2)中间的视图中:Java -> Javadoc issues -> Declaration has problems in Javadoc references -> 右边视图中的severity选择warnning便可。 自动生成serialVersionUID: 1)File --> setting --> 搜索:serializable --> 将Java | Serialization issues | Serializable class without 'serialVersionUID' 后面的对勾打上。 2)将光标放到类名上,就会出现提示信息,而后按:alt+enter,选择Add 'serialVersionUID' field 便可。
其它可参考:http://wiki.jikexueyuan.com/project/intellij-idea-tutorial/vcs-introduce.htmljava
常见问题:git
将java工程转换为maven工程:在pom.xml文件上右键,选择"Add as Maven Project "便可。
显示控制台output视图:web
1)启动服务器 2)Server -- Restore Layout
IDEA启动Tomcat时报错:Error running Tomcat7.0.52: Address localhost:1099 is already in usetomcat
分析:1099端口被其余进程占用了,故进入命令行: 1)netstat -aon | findstr 1099 # 找到占用1099端口的进程ID:PID 2)taskkill -f -pid PID 3)重启Tomcat
控制台输出中文乱码:服务器
1)Settings--Editor--File Encodings- IDE Encoding、Project Encoding、Default encoding for properties files 选项均选择UTF-8便可。 2)IDEA\IntelliJ IDEA 2016.2.1\bin目录下:idea.exe.vmoptions以及idea64.exe.vmoptions文件中添加:-Dfile.encoding=UTF-8 3)在“tomcat[local]”上右键 --> Edit Configuration --> Server -> VM options选项中添加:-Dfile.encoding=UTF-8
Git:多线程
问题:在idea的Version Control --> Local Changes中:设置Configure Ignored Files后不起做用。 分析:对应的目录或者文件已经被git跟踪,此时才设置ignore就不起做用了。 解决办法:进入工做空间的目录中执行:git rm -r --cached 要忽略的目录或文件 注: --cached 表示only remove from the index eg:git rm -r --cached .idea
多线程下debug不进断点:intellij-idea
Debug视图下,点击左边按钮栏的双红点(View Breakpoints),弹出Breakpoints窗口: 1)右侧的Disabled until selected breakpoint is hit选项:选择Any exception(下拉框中的倒数第二项) 2)右侧的After breakpoint was hit选项:选择Leave enabled 3)Done
没法进入断点,并提示:Method breakpoints may dramatically slow down debuggingapp
缘由:将断点打在了方法上了。 Debug视图下,点击左边按钮栏的双红点(View Breakpoints),弹出Breakpoints窗口:将打在方法上的断点(Java Method Breakpoints)去掉便可。
取消控制台中对行数的限制:eclipse
idea的安装目录\bin文件夹下:找到idea.properties文件,将 idea.cycle.buffer.size 的值设为 disabled ,保存后重启idea便可。
jar包版本冲突问题:
idea中Maven Projects视图下: 1)点击工具栏的第9个图标(show dependencies),稍等片刻就会出现一张显示jar包依赖关系的图。 2)红色的实线表示有冲突(右键Exclude便可解决冲突),红色的虚线表示同一个jar被屡次引用的地方。 注意: 1>Exclude冲突的jar包后,须要手动到tomcat的webapps目录下将工程删掉,而后从新部署。不然的话,\webapps\project-name\WEB-INF\lib下极可能还存在(以前下载的)冲突的jar包。 2>使用mvn dependency:tree 查看jar包之间的依赖关系不太靠谱,故推荐使用idea提供的功能。