学习J2EE第四天(从网络程序开始)

本文介绍运行J2EE tutorial例子的准备工作,包括修改build.properties文件,设置j2ee.home、j2ee.tutorial.home等属性。还阐述了J2EE架构中web组件等概念,以及Web Modules的打包、部署、更新和卸载的方法与操作步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

今天我用Sun的服务器运行了一个最简单的网络程序.非常有成就感,尽管一点技术含量都没有.
但是我对未来充满了信心.
一、运行J2EE tutorial例子前必须做的准备工作:
1.修改build.properties
先找到这个文件,是<INSTALL>/j2eetutorial14/examples/common/build.properties
(1)设置j2ee.home

在Win下:
j2ee.home = C://Sun//AppServer

j2ee.home=C:/Sun/AppServer

(2)设置j2ee.tutorial.home property asant deployment and undeployment.
设置j2ee.tutorial.home.
在Unix下:
j2ee.tutorial.home=/home/username/j2eetutorial14
Windows下:
j2ee.tutorial.home=C:/j2eetutorial14

(3)You should not install the tutorial to a location with spaces in the path.

(4) If you did not use the default value (admin) for the admin user, set the admin.user property to the value you specified when you installed the Application Server.
(5) If you did not use port 8080, set the domain.resources.port property to the value specified when you installed the Application Server.
(6) Set the admin user's password in <INSTALL>/j2eetutorial14/examples/common/admin-password.txt to the value you specified when you installed the Application Server. The format of this file is AS_ADMIN_PASSWORD=password. For example:

AS_ADMIN_PASSWORD=mypassword

二、几个概念:
在J2EE架构中,web组件和静态文件比如图片等被称为web resources.
web module是最小的可扩展的web resources单元.

To deploy a WAR on the Application Server, the file must also contain a runtime deployment descriptor.
The Application Server web application runtime DD is named sun-web.xml and is located in /WEB-INF/ along with the web application DD.

三、Web Modules
1.Packaging Web Modules
打包

asant build //根据需要编译程序.
asant create-war//打包,产生的文件以war为后缀

2.Deploying Web Modules
4种方法:
Deploying with deploytool
Deploying with the Admin Console
Deploying with asadmin
asadmin deploy full-path-to-war-file
Deploying with asant
asant deploy-war

3.Updating Web Modules
先运行asant build,然后用deploytool或Admin Console下update

4.Undeploying Web Modules
4种方法:
deploytool
# Select localhost:4848 from the Servers list.
# Select the web module in the Deployed Objects list of the General tab.
# Click the Undeploy button.
Admin Console
asadmin
asadmin undeploy context_root
asant
asant undeploy-war
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值