一、前言
安装完eclipse或者Myeclipse后,我们还需要通过配置一些常用的设置和优化,从而使工具使用更流畅更高效,具体步骤如下:
1.首先,如果你们安装注册激活,那就需要通过激活代码(如下类MyEclipseGen),或需通过注册机进行激活(myeclipse9_keygen_activator.zip点击下载)
import java.io.BufferedReader;@b@import java.io.IOException;@b@import java.io.InputStreamReader;@b@@b@public class MyEclipseGen {@b@@b@ private static StringBuffer LL = new StringBuffer(""); @b@@b@ static{@b@ LL.append(" Decompiling this copyrighted software");@b@ LL.append(" is a violation of both your license ");@b@ LL.append(" agreement and the Digital Millenium ");@b@ LL.append(" Copyright Act of 1998 ");@b@ LL.append("(http://www.loc.gov/copyright/legislation/dmca.pdf). ");@b@ LL.append(" Under section 1204 of the DMCA, ");@b@ LL.append(" penalties range up to a $500,000 fine or up to");@b@ LL.append(" five years imprisonment for a first offense.");@b@ LL.append(" Think about it; pay for a license,"); @b@ LL.append(" avoid prosecution, and feel better about yourself. ");@b@ }@b@ @b@ public String getSerial(String userId, String licenseNum) {@b@ java.util.Calendar cal = java.util.Calendar.getInstance();@b@ cal.add(1, 3);@b@ cal.add(6, -1);@b@ java.text.NumberFormat nf = new java.text.DecimalFormat("000");@b@ licenseNum = nf.format(Integer.valueOf(licenseNum));@b@ String verTime = new StringBuilder("-")@b@ .append(new java.text.SimpleDateFormat("yyMMdd").format(cal@b@ .getTime())).append("0").toString();@b@ String type = "YE3MP-";@b@ String need = new StringBuilder(userId.substring(0, 1)).append(type)@b@ .append("300").append(licenseNum).append(verTime).toString();@b@ String dx = new StringBuilder(need).append(LL).append(userId)@b@ .toString();@b@ int suf = this.decode(dx);@b@ String code = new StringBuilder(need).append(String.valueOf(suf))@b@ .toString();@b@ return this.change(code);@b@ }@b@@b@ private int decode(String s) {@b@ int i;@b@ char[] ac;@b@ int j;@b@ int k;@b@ i = 0;@b@ ac = s.toCharArray();@b@ j = 0;@b@ k = ac.length;@b@ while (j < k) {@b@ i = (31 * i) + ac[j];@b@ j++;@b@ }@b@ return Math.abs(i);@b@ }@b@@b@ private String change(String s) {@b@ byte[] abyte0;@b@ char[] ac;@b@ int i;@b@ int k;@b@ int j;@b@ abyte0 = s.getBytes();@b@ ac = new char[s.length()];@b@ i = 0;@b@ k = abyte0.length;@b@ while (i < k) {@b@ j = abyte0[i];@b@ if ((j >= 48) && (j <= 57)) {@b@ j = (((j - 48) + 5) % 10) + 48;@b@ } else if ((j >= 65) && (j <= 90)) {@b@ j = (((j - 65) + 13) % 26) + 65;@b@ } else if ((j >= 97) && (j <= 122)) {@b@ j = (((j - 97) + 13) % 26) + 97;@b@ }@b@ ac[i] = (char) j;@b@ i++;@b@ }@b@ return String.valueOf(ac);@b@ }@b@@b@ public MyEclipseGen() {@b@ super();@b@ }@b@@b@ public static void main(String[] args) {@b@ try {@b@ System.out.println("please input register name:");@b@ BufferedReader reader = new BufferedReader(new InputStreamReader(@b@ System.in));@b@ String userId = null;@b@ userId = reader.readLine();@b@ MyEclipseGen myeclipsegen = new MyEclipseGen();@b@ String res = myeclipsegen.getSerial(userId, "5");@b@ System.out.println("Serial:" + res);@b@ reader.readLine();@b@ } catch (IOException ex) {@b@ }@b@ }@b@}
2.优化调整eclipse运行的jvm虚拟机,修改安装路径下eclipse.ini文件(如:F:NJsofteclipse3.6eclipse.ini),具体配置如下
eclipse.ini内容如下,--launcher.XXMaxPermSize为配置虚拟器方法去大小空间,详细说明见jvm内存优化,-vm配置虚拟机应用路径(默认为eclipse自带或者初始化时设置的)
-startup@b@plugins/org.eclipse.equinox.launcher_1.1.0.v20100507.jar@b@--launcher.library@b@plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.0.v20100503@b@-product@b@org.eclipse.epp.package.jee.product@b@--launcher.defaultAction@b@openFile@b@--launcher.XXMaxPermSize@b@256M@b@-showsplash@b@org.eclipse.platform@b@-vm@b@C:/Program Files/Java/jdk1.6.0_22/bin/javaw@b@--launcher.XXMaxPermSize@b@256m@b@--launcher.defaultAction@b@openFile@b@-vmargs@b@-Dosgi.requiredJavaVersion=1.5@b@-Xms300m@b@-Xmx300m
eclipse常用优化设置
1.勾掉不常用初始化加载的模块
菜单路径:Window --> Preferences -->General --> Startup and Shutdown,将不常用的设置全部勾掉,加快eclipse启动加载模块,如下图1-1
图1-1
2.勾掉MyEclipse的拼写检查,如下图1-2
菜单路径:Window --> Preferences -->General -->Editors-->Text Editors-->Spelling
图1-2
3.勾掉eclipse初始化就修改文件时自动校验文件,比较费时等待及占用系统资源,如图1-3
菜单路径:Window --> Preferences -->MyEclipse --> Validation
图1-3
4.更好默认jdk,如下图1-4,
菜单路径:Window --> Preferences -->Java --> Installed JREs
图1-4
5.关闭Maven自动下载,如图1-5
菜单路径:Window --> Preferences -->MyEclipse --> Maven4MyEclipse
图1-5
6.更改文件默认打开的方式,如下图1-6
菜单路径:Window --> Preferences -->General --> Editors --> File Associations
图1-6
7.变更文件默认编码,如下图1-7所示
菜单路径:Window --> Preferences->General->Workspace
图1-7
8. 设置工作区颜色风格(Package Explorer、工作区字体颜色风格)- 如java、groovy等编辑字体背景颜色,点击菜单“Window”-"Preferences",如下图所示