Tomcat学习之一,从tomcat7源代码中生成eclipse项目并导入

一直想学习下Java的底层,但没有足够的信心,对于自己能否看懂那么多代码还是很没有低的.
但是在Java的开发中,一遇到与服务器相关的东西,就搞不定,如遇到过很多次tomcat乱码问题.等其它问题.觉得深入了解下tomcat还是很不错的.
大概一个月前还曾经弄过,但是将tomcat的源代码下下来之后,将其从编译到变成eclipse项目,还是遇到了不少麻烦的.遇到就没有弄了.今天重新开始.
将项目删除了.找来了apache tomcat7的官方文档来看.地址如下:
[url]http://tomcat.apache.org/tomcat-7.0-doc/building.html[/url]
看了下文档按照文档一步步的走.
我觉得这个地址的文档写得很详细了.我在这里就不翻译了.
值得注意的一点就是下面句话,指的是在编译之前设置一下路径.看默认的是否可用.
[quote]
Use the following commands to build Tomcat:

cd ${tomcat.source}
ant

NOTE: Users accessing the Internet through a proxy must use a properties file to indicate to Ant the proxy configuration. Read below for details.

WARNING: Running this command will download binary binaries to the /usr/share/java directory by default. Make sure this is appropriate to do so on your computer. On Windows, this usually corresponds to the C:\usr\share\java directory, unless Cygwin is used. Read below to customize the directory used to download the binaries.

The build can be controlled by creating a ${tomcat.source}/build.properties file and adding the following content to it:

# ----- Proxy setup -----
# Uncomment if using a proxy server.
#proxy.host=proxy.domain
#proxy.port=8080
#proxy.use=on

# ----- Default Base Path for Dependent Packages -----
# Replace this path with the directory path where
# dependencies binaries should be downloaded.
base.path=/usr/share/java
[/quote]

这次,我真的是新建了一个工作空间了.不再是在原来的工作空间中弄了.原来的工作空间中总是导入出错.
导入的时候也选择了copy to workspace.

由于我是用ubuntu的.这里要注意的是我用apt-get 安装的ant.这个时候,要找到ANT_HOME
的目录所在,按照我的了解,那个目录应该是/usr/share/ant

关于启动tomcat7文档里有说到:
[quote]
start-tomcat and stop-tomcat launch configurations are provided in res/ide-support/eclipse and will be available in the Run->Run Configurations dialog. Use these to start and stop Tomcat from Eclipse.
[/quote]
打开Run Configuration...配置一下,让它在run工具栏图标上显示就ok了.好了
在main函数中设下断点运行起来吧.
从start-tomcat配置来看.主函数是在,全路径是:org.apache.catalina.startup.Bootstrap
在eclipse中启动这个tomcat项目是非常的快啊.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值