1. 程式人生 > >MyEclipse、Eclipse使用配置及部分問題

MyEclipse、Eclipse使用配置及部分問題

 

簡單總結一下myeclipse首次使用的配置,eclipse類似。總結的不是很全面,如有新的看法,歡迎下方留言。

myeclipse

最優設定

1、myeclipse啟用

myeclipse、eclipse程式及啟用工具下載:點我 。啟用後檢視 myeclipse-subscription information是否成功。

2、設定字元編碼

window -> Preferences -> general -> Workspace -> Text file encoding選擇Other,將新建工程屬性編碼改變為UTF-8。

window -> Preferences -> general -> Content Types選擇Text樹,點開,選擇Java Source File。在下面的Default encoding輸入框中輸入UTF-8,按下Update按鈕,則設定Java檔案編碼為UTF-8。

3、字型大小 背景顏色設定

window -> Preferences -> general -> appearance -> colors and fonts -> basic 最後fonts一項,設定,字型大小為12

window -> Preferences -> general -> editors -> text Editors ->background colors 去掉對勾,設為護眼綠。修改 R: 204 G: 232 B: 207  或者 色調:85;飽和度:123;亮度:205即可

4、設定自動提示

Windows→Preferences→Java→Editor→Content Assist;修改Auto Activation triggers for java的值為:.abcdefghijklmnopqrstuvwxyz(,

5、設定java原始碼

windows--preferences--Java--installed jres --選中jre6--點選右邊的edit--選中jre6/lib/rt.jar

點選右邊的 source attachment configuration -- external file selection --找到你的jdk下的src.zip檔案,選擇新增即可

6、新增jre執行環境、tomcat伺服器

在搜尋框搜尋installed JREs 、Tomcat。新增相關檔案到myeclipse上。

7、設定建立JSP頁面預設編碼設為UTF-8

Window -> Preferences -> MyEclipse -> Files and Editors -> JSP,將"Encoding"選為"ISO10646/Unicode(UTF-8)

8、關閉自動更新:

  • Eclipse:首先進入Windows –> Perferences–> Install/Update -> Automatic Updates,不要勾選"Automatically find new updates and notify me"。
  • Myeclipse:

Windows –> Perferences–> MyEclipse... -> Maven4MyEclipse,不要勾選"Download repository index updates on startup" 。

9、外掛的新增方法

首先下載多個外掛,解壓到本地。在myeclipse的dropins資料夾新建link檔案, 如svn.link abc.link;svn.link內容為 path=D:\\MyEclipse\\svn;abc.link內容為 path=D:\\MyEclipse\\abc

10、新增快捷註釋

通過選單 Window->Preference ->Java -> Code Style -> Code Templates  修改Types 如下

  1. /**
  2. * @ClassName: ${type_name}
  3. * @description:
  4. * @author: ${user}
  5. * @date ${date} ${time}
  6. * ${tags}
  7. */

修改Methods,如下

  1. /**
  2. * @title: ${enclosing_method}
  3. * @description:
  4. * @author: ${user}
  5. * @date ${date} ${time}
  6. * ${tags}
  7. */

Eclipse快捷鍵:選中你的方法  Alt+Shift+J

常見問題

1、從外部匯入工程到myeclipse8.5報錯:Background Indexer Crash Recovery java.lang

  • Help > MyEclipse Configuration Center > Dashboard tab
  • 在Add-ons下取消勾選:"MyEclipse IE Javascript Debugger (Windows Only)"
  • 重啟 在右下方的掛起面板(Pending Changes)選擇:Apply 1 change 稍等···

2、關於JPEGImageEncoder報錯的問題

修改Windows-Preferences-Java-Compiler-Errors/Warnings裡面的Deprecated and restricted API中的Forbidden references(access rules)選為Warning就可以編譯通過了,是eclipse的設定問題。

3、org.apache.jasper.JasperException: Unable to compile class for JSP

【Window】->【Preferences】->【Java】->【Compiler】->【JDK Compliance level】->1.4調高到1.6編譯版本

將專案和tomcat下的web->web->web-info->lib中的jsp-api.jar和servlet-api.jar刪除,重啟伺服器,重新執行

4、SVN同步時忽略某些檔案型別和資料夾

開啟:window-->preferences-->team-->Ignored Resource-->Add Pattern  忽略資料夾:
如忽略target資料夾,就Add Pattern,填入*/target/*  忽略檔案:如忽略.class型別的,直接填入 .class

5、怎麼關閉MyEclipse的.html .jsp的視覺化編輯器

選擇選單windows -> preferences->General-> Editors -> File Associations

在上方框內選擇*.jsp(或*.html),在下方框內選擇MyEclipse JSP Editor(或MyEclipse html Editor),按Default即可

6、BASE64Encoder類使用報錯

檢查jre環境是否為本機安裝的jdk1.6,1.7或1.8,更換sun jdk為本機安裝額oracle jdk即可。或者右鍵專案-》屬性-》java bulid path-》jre System Library-》access rules-》resolution選擇accessible,下面填上** 點選確定即可!!