各种设置配置
本文如有借用其他博文观点的部分已做说明,其余均为个人总结。总结不易,转载请注明出处。
把Sublime Text 3 添加到右键菜单
基于https://my.oschina.net/adairs/blog/466777提供的方法一
亲测"用 SublimeText3 打开"可能会出现中文乱码的问题,建议改为"Edit with SublimeText3"
<pre class="md-fences md-end-block ty-contain-cm modeLoaded" lang="shell" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 1em 6px; margin-bottom: 15px; margin-top: 15px; width: inherit; color: rgb(51, 51, 51); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;" contenteditable="true" spellcheck="false" mdtype="fences" cid="n9">[Version]
Signature=""
[DefaultInstall]
AddReg=SublimeText3
[SublimeText3]
hkcr,"\shell\SublimeText3",,,"用 SublimeText3 打开"
hkcr,"\shell\SublimeText3\command",,,"""%1%\sublime_text.exe"" ""%%1"" %%"
hkcr,"Directory\shell\SublimeText3",,,"Edit with SublimeText3"
hkcr,"\shell\SublimeText3","Icon",0x20000,"%1%\sublime_text.exe, 0"
hkcr,"Directory\shell\SublimeText3\command",,,"""%1%\sublime_text.exe"" ""%%1"""</pre>
运行安装完可以打开 “win+R” 敲 “regedit”打开注册表,找到新加入的注册表,以便理解命令究竟做了什么。
Maven安装 / 配置Maven环境变量
去官网http://maven.apache.org/download.cgi选择 Binary zip archive 下载并解压
然后设置环境变量:Path增加一项,maven的bin目录。
<pre class="md-fences md-end-block ty-contain-cm modeLoaded" lang="" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 1em 6px; margin-bottom: 15px; margin-top: 15px; width: inherit; color: rgb(51, 51, 51); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;" contenteditable="true" spellcheck="false" mdtype="fences" cid="n16">#### 快速打开环境变量的方法:</pre>
win+R 敲 “sysdm.cpl” 打开系统属性,选“高级”
点确定后,win+R "cmd" 打开DOS,敲“mvn -version”看是否安装成功
The JAVA_HOME environment variable is not defined correctly报错
JAVA_HOME需设置为jdk的根目录,而不是bin目录,而且最后一定以 / 结尾(因为多了不要紧,少了则''%JAVA_HOME%bin'会出现问题),更改设置后要注意重新打开DOS再看版本才能看到变化。
设置本地Maven仓库
打开maven安装目录的conf/settings.xml,或者eclipse在用的,自己重写的settings.xml
找到<localRepository>标签(我的在第53行,不同版本可能不一样)将注释去掉, 把路径改为想要的
可以打开eclipse验证一下究竟设置好没有,注意User Settings 需为刚刚更改的那个文件。点Update Settings,Local Repository变为设置好的位置
此外eclipse的maven设置还有一处
优化eclipse速度
参考:给Eclipse提速的7个技巧;Eclipse内存讲解,eclipse.ini设置;JVM(Java虚拟机)优化大全和案例实战;
eclipse.ini解析与优化
打开安装路径的eclipse.ini,下面结合两个官方文档解析一下我本地的eclipse.ini
<pre class="md-fences md-end-block ty-contain-cm modeLoaded" lang="shell" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 1em 6px; margin-bottom: 15px; margin-top: 15px; width: inherit; color: rgb(51, 51, 51); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;" contenteditable="true" spellcheck="false" mdtype="fences" cid="n34"># ini文件(可安装文件)设置规则:
命令中间有空格需要换行
值中间有空格需要用""包裹
-startup#用于启动的jar包
plugins/org.eclipse.equinox.launcher_1.4.0.v20161219-1356.jar
--launcher.library#可执行文件的共享库
C:/Users/Q/.p2/pool/plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.551.v20171108-1834
-product#
org.eclipse.epp.package.jee.product
-showsplash
org.eclipse.epp.package.common
--launcher.defaultAction
openFile
--launcher.appendVmargs#命令行参数将追加到本文件vm参数后,而不是覆盖
-vmargs#设置JVM参数,后面都是参数
-Dosgi.requiredJavaVersion=1.8
-Dosgi.instance.area.default=@user.home/eclipse-workspace
-XX:+UseG1GC
-XX:+UseStringDeduplication
--add-modules=ALL-SYSTEM
-Dosgi.requiredJavaVersion=1.8
-Xms256m#设置最小最大堆内存
-Xmx1024m
--add-modules=ALL-SYSTEM
-Declipse.p2.max.threads=10
-Doomph.update.url=http://download.eclipse.org/oomph/updates/milestone/latest
-Doomph.redirection.index.redirection=index:/->http://git.eclipse.org/c/oomph/org.eclipse.oomph.git/plain/setups/</pre>
JVM属性,Oracle官方文档:https://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html
Eclipse 运行参数官方文档:http://help.eclipse.org/kepler/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/misc/runtime-options.html
分析完我决定增加以下几个参数
<pre class="md-fences md-end-block ty-contain-cm modeLoaded" lang="shell" style="box-sizing: border-box; overflow: visible; font-family: var(--monospace); font-size: 0.9em; display: block; break-inside: avoid; text-align: left; white-space: normal; background-image: inherit; background-position: inherit; background-size: inherit; background-repeat: inherit; background-attachment: inherit; background-origin: inherit; background-clip: inherit; background-color: rgb(248, 248, 248); position: relative !important; border: 1px solid rgb(231, 234, 237); border-radius: 3px; padding: 8px 1em 6px; margin-bottom: 15px; margin-top: 15px; width: inherit; color: rgb(51, 51, 51); font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;" contenteditable="true" spellcheck="false" mdtype="fences" cid="n38">-vm
E:/jdk1.8.0_91/</pre>
G1垃圾回收器的字符串去重
参考:Java Performance Tuning Guide by Mikhail Vorontsov
Java8u20版本(8 update 20) 中引入了字符串去重。一般来说,很多String对象是冗余的,存在许多 a != b 但 equals b 的情况,即引用不等但值相等。
最初JDK有一个String.intern()
eclipse窗口配置——关闭启动加载
预加载插件 Preferrnces > General > Startup and Shutdown
单词拼写检验 Preferrnces > General > Editors > Text Editors > spelling
Maven更新策略 Preferrnces > Maven 取消 Download respository index updates on startup
语法校验 Preferrnces > validation
禁用主题 Window > Preferences > General > Appearance 取消 'Enable animations'
菜单管理 Window > Perspective > Customize Perspective