---
title: "eclipse配置"
author: "bestwinner"
date: "2013-12-30T12:44:11Z"
tags: []
categories: ["非技术"]
slug: "eclipse"
draft: false
lastmod: "2014-01-04T15:36:11Z"
id: 1994904
url: "https://bestwinner.iteye.com/blog/1994904"
---

**一.Eclipse中查看JDK类库的源代码**

1.点 “window”-&gt; "Preferences" -&gt; "Java" -&gt; "Installed JRES"

2.此时"Installed JRES"右边是列表窗格，列出了系统中的 JRE 环境，选择你的JRE，然后点边上的 "Edit..."， 会出现一个窗口(Edit JRE)

3.选中rt.jar文件的这一项：“c:\\program files\\java\\jre\_1.5.0\_06\\lib\\rt.jar”  
点 左边的“+” 号展开它，

4.展开后，可以看到“Source Attachment:(none)”，点这一项，点右边的按钮“Source Attachment...”, 选择你的JDK目录下的 “src.zip”文件

5.一路点"ok",结束。

dt.jar是关于运行环境的类库,主要是swing的包  
tools.jar是关于一些工具的类库  
rt.jar包含了jdk的基础类库，也就是你在java doc里面看到的所有的类的class文件

 

**二.eclispe设置字体**

window--preferences--General--appearance--colors and fonts--java--"java editor text font"

设为Courier New字体

 

**三.eclipse中设置编码**  
1.project-&gt;properties-&gt;resource  
2.window-&gt;preferences-&gt;general-&gt;workspace  
3.Run -&gt;run configurations-&gt;common  
还有就是window-&gt;preferences-&gt;general-&gt;content types也可以设置。

 

**四.去掉F2提示**

1.点 “window”-&gt; "Preferences" -&gt; Java-&gt;edit-&gt;hovers

2.不勾Combined hovers

 

**五.eclipse 注释内容颜色修改**

```
window--preference-java-editor-syntax coloring-comments里面的前两个改颜色

```

 

**[六.Eclipse颜色设置](http://blog.csdn.net/tt_zhang/article/details/7585586)**

以下摘自：

http://blog.csdn.net/tt\_zhang/article/details/7585586

 

颜色的设置主要有以下几个地方:

1.Windows -&gt; Preferences -&gt; General -&gt; Appearance -&gt; Colors and Font

      basic -&gt; Text Font

      这里可以设置字体

2.Windows -&gt; Preferences -&gt; General -&gt; Editors -&gt; Text Editors

      Line number foreground行号前景色设置  
      Current line highlight当前行高亮颜色设置  
      Print margin打印页边距颜色设置  
      Find scope查找作用域颜色设置  
      Selection foreground color选择的内容的前景色设置  
      Selection background color选择的内容的背景色设置  
      Background color背景色设置  
      Foreground color前景色设置  
      Hyperlink超链接颜色设置

3.Windows -&gt; Preferences -&gt; General -&gt; Editors -&gt; Text Editors -&gt; Annotations

       这里设置注释相关的颜色

4.Windows -&gt; Preferences -&gt; Java -&gt; Editor -&gt; Syntax Coloring

       这里是设置的重头戏,大部分的语法颜色都在这设置

       要逐项的细细查看

5.Windows -&gt; Preferences -&gt; Java -&gt; Editors -&gt; Properties Files Editor

      Properties文件颜色设置

6.windows-&gt; preferences-&gt;java-&gt;Editor-&gt;Mark Occurences

      这里是高亮显示相同的变量的设置位置,颜色设置在

       Windows -&gt; Preferences -&gt; General -&gt; Editors -&gt; Text Editors -&gt; Annotations -&gt; Occurrences

7.Windows -&gt; Preferences -&gt; Run/Debug

       Run/Debug相关设置,输出控制台的颜色设置在下面的Console子项

 

 

[eclipse 运行调优（JVM参数配置）](http://blog.csdn.net/lhooouuu/article/details/7220721)

```

```

[http://blog.csdn.net/lhooouuu/article/details/7220721](http://blog.csdn.net/lhooouuu/article/details/7220721)

--1.设置最大的堆和最小堆大小.两者一样表示固定大小.这样可以防止老年代内存扩展造成额外的gc.

当然也会多占一些内存.系统内存不足的慎用

-Xms512m

-Xmx512m

--加大年轻代内存.减少minor gc

-Xmn164m

--这个是永久代大小.默认是64M,增加到96M.固定大小,减少扩展造成的gc

-XX:PermSize=96m

-XX:MaxPermSize=96m

--去除字节码验证

-Xverify:none

--屏蔽显示调用gc.

-XX:+DisableExplicitGC

--关闭类垃圾回收，就可以消除由于多次装入和卸装同一个类而造成的开销

-Xnoclassgc

--指定最适合多任务并行的CMS垃圾收集器

-XX:+UseParNewGC

-XX:+UseConcMarkSweepGC

--修改默认的触发老年代full gc的内存所占比..改成85%

-XX:CMSInitiatingOccupancyFraction=85