添加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中应该设置:
将class文件输出到指定文件夹
Project
=>Properties
=>Java Build Path
=>Source
=>Browser...
这样做的用途:
在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
看看效果,呦吼~
将已经存在的项目载入eclipse中时出现No projects are found to import
原因:
工程项目的个目录下面没有.project和.classpath这两个文件
解决:
- 建一个项目,这个项目的项目名要import的项目名称一样;
- 新建的项目目录里面有上述的两个文件,把上述两个文件拷到你要import的项目目录下面;
- 删除之前建的那个项目,然后再重新import。
修改Eclipse的编码格式
Window
=>Preferences
=>Work Space
导入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?
- On your Eclipse IDE, go into
Window
>Preferences
>Java
>Installed JREs
> and check yourinstalled JREs
. You should have an entry with a JDK there. - Select the Execution Env as show below. Click
OK
- Then
Right-Click
on 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 是终止正在运行的进程