Ubuntu java web 在eclipse下的搭建过程

来源:互联网 发布:汇成凯网络 编辑:程序博客网 时间:2024/05/16 04:34

第一步:
安装Web Tools Platform(wtp)

打开eclipse 打开菜单栏中的Help > Install new software > 在弹出窗口中的Work with:

选中:Indigo Update Site - http://download.eclipse.org/releases/indigo/

在name列表中选中: Web, XML, Java EE and OSGi Enterprise Development

注:如果打开eclipse出现错误窗口:An error has occurred.See the log File /home/username/.eclipse/org.eclipse.platform_x.x.x_xxxxxx/configuration/xxxxxx.log

log中出现:

java.lang.UnsatisfiedLinkError:Could not load SWT library.

32位:ln -s /usr/lib/jni/libswt-* ~/.swt/lib/linux/x86/

64位:ln -s /usr/lib/jni/libswt-* ~/.swt/lib/linux/x86_64/

重启再打开Eclipse就装好了web的环境

第二步:
安装tomcat,去官网下载,比如下载tomcat8.develop.tar.gz。
或者,在web下运行web项目,弹出RUN ON SERVER窗口,在localhost下下载新的tomcat。安装完成后运行,如果出现这个错误:
Setting property ‘source’ to ‘org.eclipse.jst.jee.server:web’ did not find a matching property
解决方法:
(一)
1.首先,确保你的服务是出于关闭的状态;

2.双击你 eclipse 下方 Servers 卡片里的服务器,比如我的是 Tomcat v6.0 Server at localhost,双击后将弹出一个关于此服务器配置信息的预览窗口;

3.在该窗口下方有个 Server Options 卡片,请将 Publish module contexts to separate XML files 前面的复选框勾上并保存;

4.重新启动你的服务,此时查看 eclipse 控制台信息,发现那刺眼的红色警告信息没有了,恭喜你,这说明问题解决了。

(二)
1. 修改conf/context.xml文件,新加两个属性.

<Context  reloadable="true" privileged="true">     <!-- Default set of monitored resources -->    <WatchedResource>WEB-INF/web.xml</WatchedResource></Context>
  1. 重启Eclipse,此步非常重要,一定要做
0 0
原创粉丝点击