eclipse编码及创建servers问题

来源:互联网 发布:淘宝保丽净价格 编辑:程序博客网 时间:2024/06/08 12:13

1、 Eclipse项目编码设置:

一般Java文件编码格式是UTF-8的。以下以默认GBK改为UTF-8为例。

1.改变整个工作空间的编码格式,这样以后新建的文件也是新设置的编码格式。          eclipse->window->preferences->General->workspaceTypes->Other->UTF-8->OK

    汉化版:eclipse->窗口->首选项->常规->工作空间->其它->UTF-8->确定

2.项目范围的设置编码格式

Project->Properties->General->Resource->Other->UTF-8->OK

3.某类型文件的编码格式

eclipse->window->preferences->General->Content Types->右边找到要修改的文件的类型(JAVA,JSP等等)->在下面的Default encoding,输入框中输入UTF-8->Update->OK

汉化版:eclipse->窗口->首选项->常规->内容类型->在右边选择要修改文件的类型->下面缺省编码输入->更新

 

4、单个文件设置编码格式

在包资源管理器右键点击文件->属性,改变文本文件编码格式为UTF-8

 

注:改变编码格式前做备份,另外可以用编码格式批量转换工具处理下,搜索下网上很多这样的小工具。

2、Tomcat配置被删除或者更改了工作空间无法创建tomcat的servers:

Some times if we delete the servers configuration in the workspace or if we move the workspace adding tomcat as server can become difficult thing. We will hit with the errorCannot create a server using the selected type.
To resolve this error, try one or all of the following:
1. Go to Window–>Preferences–>Server–>Runtime Environments and fix the broken path/link for the server
2. Rename the org.eclipse.jst.server.tomcat.core.prefs toorg.eclipse.jst.server.tomcat.core.prefs.bak (or you can delete this file). This file can be found at \workspace\.metadata\.plugins\org.eclipse.core.runtime\.settings
3. Rename the org.eclipse.wst.server.core.prefs toorg.eclipse.wst.server.core.prefs.bak (or delete the file). This file also can be found at the same location as above

3eclipse部署,在tomcat中找不到eclipse发布的项目。eclipse更改项目发布路径

在新版的eclipse中,配置好项目,发布之后,发现在tomcatwebapps下找不到该项目,而是在d:\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps
下,解决办法就是重新配置一下eclipsetomcat下对项目的发布路径。

首先在工作面板中找到“servers”,然后右键点击当前的tomcat,然后选择remove(最好先把项目停掉),然后再右键选择“clean..”

 

其次双击那个tomcat,就会进入它的配置界面,然后找到左边第二个 Server Locations,你那个单选框选中的应该是第一个,你选择第二个就行。

如果你想自由选择发布目录,而不是发布在tomcatwebapps下面,你就选择第三个,在 Server Path中输入你想要的路径后,保存即可以了。

选择第二个之后,再在下面的depoly path中选择tomcat下的webapps就行,这里也可以指定一个自己新建的文件夹。

然后点击“ctrl+S”保存就行。

 

 

0 0
原创粉丝点击