Eclipse使用

添加dtd文件

Window => Preferences => XML XML Catalog => add

例如mybatis-config.xml文件的文件頭如下:

<!DOCTYPE configuration
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">

在Eclipse中應該設置:

添加dtd文件

將class文件輸出到指定文件夾
Project=>Properties=>Java Build Path=>Source=>Browser...

修改class文件輸出路徑

這樣做的用途:
在eclipse中默認輸出的class實在bin目錄下的,但是在默認情況下,tomcat會在WEB-INF/classes這個目錄下查找class文件,而不是在bin目錄下查找。通過更改class文件的輸出路徑到WEB-INF/classes這樣的操作,我們可以把web應用方便地部署到tomcat。

顯示空包或web/WEB-INF下的classes文件夾
Navigate=>Show In=>Navigator <=> Alt+Shift+W
看看效果,呦吼~

Package Explorer.PNG

Navigator.PNG

將已經存在的項目載入eclipse中時出現No projects are found to import

原因:
工程項目的個目錄下面沒有.project和.classpath這兩個文件

解決:

  1. 建一個項目,這個項目的項目名要import的項目名稱一樣;
  2. 新建的項目目錄里面有上述的兩個文件,把上述兩個文件拷到你要import的項目目錄下面;
  3. 刪除之前建的那個項目,然后再重新import。

修改Eclipse的編碼格式
Window=>Preferences=>Work Space

GBK-UTF-8.PNG

導入Maven項目:The declared package "com.myself" does not match the expected package "main.java.com.myself"

Set my-project/src/main/java as the source folder (Project => Properties => Java Build Path => Project => Add Folder). Remove the old source folder.

Restart eclipse if necessary.

Simply put, Eclipse thinks that your project begins at my-project/src. Therefore, it expects all packages to descend from there, starting with main.java.
問題解決來自:stackoverflow
The tomcat server configuration at /sever/tomcat v7.0 localhost-config is missing
原因:做項目時用的tomcat的版本/路徑和現在用 不一樣,tomcat版本或者路徑問題。
解決:更改項目的tomcat或者路徑版本方法。
項目右擊=>run as=>run on server=> manually define a new server

No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

  1. On your Eclipse IDE, go into Window > Preferences > Java > Installed JREs > and check your installed JREs. You should have an entry with a JDK there.
  2. Select the Execution Env as show below. Click OK
  3. ThenRight-Clickon your Project -> Maven -> Update Project

Additionally, you may have to change Maven JRE which is as follows. Goto Run -> Run Configurations, selecting the Maven Build I was running (from the left panel). Then, I clicked the JRE tab and selected the option Workspace default JRE


添加注釋
Java:Ctrl+/
XML:Ctrl+Shift+/
設置Class Path
控制行輸出行數
在Console上右擊 => Preferences => 修改 Limit console output

重命名
alt+shift+R

Insert
插入變改寫:Inert鍵可以打出一個的時候刪掉一個字。
另外:終端下
Ctrl+Insert是復制
Shift+Insert是粘貼
Ctrl+C 是終止正在運行的進程

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容