eclipse新建工作空间(workspace)初试设置
第一步:
为了保护视力,先对电脑窗口的背景色进行修改:
设置方法:打开控制面板中的"显示"选择外观(appearance)-高级(advanced),然后在项目(items)那栏选窗口(windows),再点颜色(color) -其它颜色(others),然后把Hue(色调)设为85,Sat(饱和度)设为90,Lum(亮度)设为205。然后单击添加到自定义颜色(Addtocustomcolors),按“确定”...一直确定。 把窗口设成绿色之后,再来把IE的网页背景也变成养眼的绿色吧:打开IE,点击工具(TOOLS),点INTERNET选项(INTERNETOPTIONS),点右下角的辅助功能(Assessibility),然后勾选不使用网页中指定的颜色(ignorecolorsspecifiedonwebpages),然后点“确定”退出
第二步:
Eclipse中创建新类时自动生成注释
windows-->preference-->Java-->Code
Style-->Code Templates-->code-->new
Java files
编辑它 ,内容如下
- ${filecomment}
- ${package_declaration}
- /**
- * @Title: ${file_name}
- * @Package ${package_name}
- * @Description: ${todo}
- * @author ${user}
- * @date ${date} ${time}
- * @version V1.0.0
- */
- ${typecomment}
- ${type_declaration}
Alt+Shift+J 手动插入类的注释时,修改如下:
window -> preferences -> Java -> Code Style -> Code Temples
点击 Comments ->Types 点击 Edit
- /**
- * @Description: ${todo}
- * @author ${user}
- * @date ${date} ${time}
- */
第四步:
格式化代码时,一行最多字符数
java-CodeStyle-Formatter,点new,新建一个自己的配置文件, 点edit,在新打开的窗口中选Line Wrapping选项卡, 修改Maximum line width 为140,保存。
第五步:
设置控制台显示打印的最大行数,以免错误信息被冲掉:
window -> preferences ->Run/Debug-->Console
把Console buffer size(characters) 设置成:999999
第六步:修改工作空间默认项目编码(我这里修改成UTF-8)
window -> preferences ->General-->Workspace
把Text file encoding的编码选择UTF-8
第7步:修改HTML、JSP等,新建时的默认编码设置
window -> preferences ->Web-->HTML Files
或者
window -> preferences ->Web-->JSP Files
第八步:
设置jsp模板:
eclipse -- >perferences - >web ->jsp - jsp files -Editor ->templates 在这里可以设置模板。
将 JSP WITH HTMl 里面内容替换为如下:
<%@ page language="Java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%
request.setCharacterEncoding("UTF-8");
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>标题</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
</head>
<body>
${cursor}
</body>
</html>
替换之后那么以后新建的jsp一般默认的都是这个格式了。
10 配置本地服务器。(我用的tomcat)将tomcat路径添加到服务器中。
11 设置高亮显示: