一、工具优化
以下为 MyEclipse 开发环境的基础优化设置,涵盖编码、字体、插件等常用配置。
- 修改当前工作区下所有项目编码:Window->Preferences->General->Workspace->Text File Encoding改为UTF-8
- 修改当前项目编码:项目->右键->properties->Text File Encoding改为UTF-8
- 增删工具栏图标:Window->Customize Perspective
- 调整字体:文件内右键->Preferences->General->Appearance->Colors and Fonts
- 修改默认打开视图:Window->Preferences->General->Editor->File Associations->修改视图
- 修改启动和关闭时加载的插件:Window->Preferences->General->Startup and Shutdown
- 修改最大行宽:Window->Preferences->Java->Code Style->Formatter->Line Wrapping(自带格式无法编辑,必须新建)
- 修改Jsp编码:Window->Preferences->Myeclipse->Files and Editors->Jsp的Encoding改为UTF-8
- 恢复myeclipse默认设置:File->Switch Workspace查看工作空间路径,进入目录,删除.metadata回复默认
- 查看&清理内存:Myeclipse->Utilities->Show Heap Status
- 代码补全提示:Window->Preferences->Java->Editor->Content Assist
- 修改Myeclipse的maven版本为自己下载的:Window->Preferences->MyEclipse->Maven4MyEclipse->Installations;同时修改用户配置:Window->Preferences->MyEclipse->Maven4MyEclipse->User Settings
- 将JRE版本改为默认:Configure Build Path->Edit JRE Library->选Workspace Default JRE(以防别人机子上的jdk版本不同)
- 添加@自动提示:Window->Preferences->Java->Editor->Content Assist->**** for java->在“.”后添加“@”符号
- 设置新建jsp默认编码:Window->Preferences->MyEclipse->Files and Editors->JSP
- 将tab替换为4个空格:Window -> Preferences -> General -> Editors -> Text Editors,选中“Inserts spaces for tabs”
- JDK不使用MyEclipse自带的JRE:Window->Preferences->Java->Installed JREs->Search
- Myeclipse 2013中去除derby:安装目录\configuration\org.eclipse.equinox.simpleconfigurator\bundles.info,搜索derby注释整行
- 加大Myeclipse中Console的显示行数:Window->Preferences->Run/Debug->Console,去掉对Limit console output的选择,或者选择后设置buffer size值
- 禁止Myeclipse自动弹出控制台:Window->Preferences->Run/Debug->Console,取消勾选 Show when program writes to standard out(当console中有输出时弹出)前的选项和 Show when program writes to standard error(当console中有错误时弹出) 前的选项
- Eclipse中查看当前工程的JDK(编译)版本:项目->右键->properties->Java Complier
- Eclipse中查看/修改当前工程的JRE版本:项目->右键->Run As->Run Configurations->Java Application->项目名->JRE
- Eclipse中查看/修改代码模板:Window->Preferences->Java->Editor->Templates
- 删除Server视图下的Myeclipse Tomcat:Myeclipse Tomcat->右键->Configure Server Connector->勾选Disable
- 查看Myeclipse启动时默认的JVM(JRE):Window->Preferences->Help->about Myeclipse->Installation Details->-vm 下的参数
二、修改 MyEclipse 启动时默认的 JVM(JRE)
以下为修改 MyEclipse 启动时默认 JVM 的三种方式:
- 直接把要使用的JRE文件夹拷贝到Eclipse目录下;
- 修改eclipse.ini文件,添加-vm参数,指定要运行的虚拟机的地址,使用-vm命令行自变量例子:-vm c:\jre\bin\javaw.exe
- 修改MyEclipse或者Eclipse启动的快捷方式。在快捷方式上“右键”---->“属性”例如:
默认情况下,我的MyEclipse的快捷方式属性是:
目标"D:\Program Files\MyEclipse 6.0\eclipse\eclipse.exe" -vm "d:\Program Files\MyEclipse 6.0\jre\bin\javaw.exe"
启始位置"d:\Program Files\MyEclipse 6.0\eclipse"
只需要把目标的内容进行修改,例如我修改为:
"D:\Program Files\MyEclipse 6.0\eclipse\eclipse.exe" -vm "D:\Program Files\jdk1.6.0_24\bin\javaw.exe"
三、常用设置
以下为 MyEclipse 日常开发中常用的项目与视图设置。
- 修改Copy来的项目web路径名:项目->右键->properties->MyEclipse->Project Facets-> Web->Web Context-root
- 添加User Libraries:Window->Preferences->Java->Build Path->User Libraries
- myeclipse验证jquery错误的问题:jquery-1.8.0.min.js-> 鼠标右键 -> MyEclipse -> manage validation -> 左面点击 -> Excluded resources -> 找到jquery.js -> 打上钩 -> apply
- 重新提示工作路径:Myeclipse安装目录\configuration\.settings\org.eclipse.ui.ide.prefs ,修改SHOW_WORKSPACE_SELECTION_DIALOG=true或者Window->Preferences->General->Startup and Shutdown->Workspaces
- 或Window->Preferences->Java->Java dialogs->Clear按钮
- 如何查看MyEclipse包含的Eclipse的版本号:打开安装目录下readme文件夹里的readme_eclipse.html文件或在控制台输入java -version
- 将myeclipse自带类库中的某个jar包移除:项目->右键->Build Path->Configure Build Path->选中需要修改的类库->Edit->勾选Enable project specific advanced configuration
- 在package视图下用树形结构查看库:点击左侧浏览视图的箭头->Package Presentation->Hierarchical
- 隐藏当前工作环境中关闭的工程:点击左侧浏览视图的箭头->Filters...->勾选Closed projects
- 修改xml文件格式化时的最大行宽:Window->Preferences->MyEclipse->Files and Editors->XML-> XML Source->Line width
- 取消拼写检查:Window->Preferences->General->Editor->Spelling->取消勾选Enable spell checking前的复选框
- 关闭Maven4Myeclipse插件在Myeclipse启动时updating indexes:Window => Preferences => Myeclipse=> Maven4Myeclipse取消勾选的Enable Maven4MyEclipse features
四、快捷功能
以下为 MyEclipse 中常用的快捷键操作。
- 查看快捷键列表:Ctrl+Shift+L
- 添加Import语句:Ctrl+Shift+M——(先把光标放在需导入包的类名上)
- 整块向左缩进:Shift+Tab
- 输出选中代码:选中后按ALT+/,选择sysout
- 快速编辑模式:Alt+Shift+A
- 替换/查找选中范围的文本:选中->Ctrl+F->勾选Scope内的Select Lines