设置idea

来源:互联网 发布:电子数据交换的意思 编辑:程序博客网 时间:2024/06/03 21:11

异常栈

javax.naming.CommunicationException: localhost:389 [Root exception is java.net.ConnectException: Connection refused: connect](最后执行的)

该行会明确指出所抛出的异常。

  at com.sun.jndi.ldap.Connection.<init>(Connection.java:226)
  at com.sun.jndi.ldap.LdapClient.<init>(LdapClient.java:136)
  at com.sun.jndi.ldap.LdapClient.getInstance(LdapClient.java:1608)
  at com.sun.jndi.ldap.LdapCtx.connect(LdapCtx.java:2698)
  at com.sun.jndi.ldap.LdapCtx.<init>(LdapCtx.java:316)
  at com.sun.jndi.ldap.LdapCtxFactory.getInitialContext(LdapCtxFactory.java:71)
  at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:684)
  at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:307)
  at javax.naming.InitialContext.init(InitialContext.java:242)
  at javax.naming.InitialContext.<init>(InitialContext.java:216)  (最先执行的)

idea激活

idea的激活(激活地址要换着用,否则可能会出现不能激活的问题)

http://idea.iteblog.com/key.php

http://idea.imsxm.com/

要想找到目标代码,就得有一个起点,一般地,登录页面就是“起点”。

debug详解

在debug透视图中,有一个Debugger,它显示了方法的后进先出的调用栈(栈顶指针在该透视图的上面,而不是下面)。

1.mute breakpoints: 让所有的断点都变成哑巴

2.step over : step over a line of code

3.step into :  Step into a method called from this line of code.

4.step out : Step out of a method back to the calling code.

5.resume program: Resume debugging and stop at the next breakpoint.


IntelliJ IDEA will step into most code with two exceptions(2个除外): stepping skipping and 《classes compiled without the debug flag》

Code can be configured to be skipped in stepping

example, any com.sun.* classes is skipped by default. 

This is defined in Preferences | Build, Execution, Deployment | Debugger | Stepping.

但是, Force Step Into option 可以step into "skipped code"。

注意:尽量不要使用反汇编代码debug

If we don't have the source to specific code, IntelliJ IDEA will still decompile the class and show our steps in the decompiled source.

This is very helpful, but note that the generated decompiled class may look different from the original, 

and if the lines do not match, debugging in decompiled code may be confusing. 

Always try to obtain the source code of the classes you want to step into.


idea中的重要快捷键

Ctrl+Alt+鼠标左键     查看方法的实现

在搜索栏中输入“case”,可以查看大小写转换开关键。

与编辑历史有关的:

           alt + shift + 向左箭头 | 向右箭头

           也可以直接使用鼠标的button4 | button5


如果发现Java文件的图标不正确(比如说,Java文件的图标要么是c,要么是i),就说明你的工程结构有问题

注意:在idea中,module应该翻译成“模块”

facets和artifact的区别:

facets表示这个module有什么特征,

artifact表示项目的成品。其中有打成War的,也有使用 explod的。

注意:使用tomcat部署项目时,artifact表示使用项目的成品进行部署,

external source表示使用外部非本项目的成品来部署项目。

工程结构

工程结构在idea中的作用非常重要,它包括:

1.工程SDK: 安装在电脑上的jdk路径

2.工程语言水平:一般使用6,因为服务器可能不支持高版本。

3.工程编译输出路径:【这个最重要】,工程跟路径/target/classes

修改完工程编译输出路径后,一定要重新部署一下tomcat,否则tomcat的输出路径也会是错的。

什么是重新部署?见下图(先点击红色的减号,再点击绿色的加好把工程加进来)


注意:在Fedora中运行idea时,不要使用root用户,而要使用你登录电脑时用的那个用户,否则会报错。


首次使用idea,要这样设置:
file→setting→搜索appearance设置主题为Darcula,字体为Microsoft YaHei UI 。搜索encoding,将各种编码都设置成utf-8。搜索font,将字体改为Consolas


注意:如果将appearance中的字体设置成consoles,可能会出现乱码问题。
非范畴注意:在url和linux中都是用"/"表示路径,只在window文件系统中用"\"表示文件路径