您的位置:首页 > 编程语言 > Java开发

Java运行环境配置之(Resin配置、域名邦定、IIS整合)

2008-03-07 00:03 369 查看
2005-12-27 11:05:27  作者:bluepoint  来源:71i.net 网友评论 0 条 论坛

4898
  N久前,开始用Java做程序了,但一直被虚拟机的问题所困,让我最难过的是不会邦定域名,找了好多网上的资料都不管用,真是郁闷啊。

今天我给大家共享一下我的配置方法:

Resin 2.1.14 + Mysql 2.23 + J2sdk 1.4.2

需要软件:

Resin 2.1.14 下载:http://www.caucho.com/download/index.xtp
MySQL 2.23 下载:http://www.mysql.com
J2sdk 1.4.2 下载:http://java.sun.com/j2se/1.4.2/download.html

一、MySQL的安装
1、解压缩mysql.zip
2、运行setup.exe安装文件
3、下一步,这里只要选择一下你安装目录
4、安装结束后,进入您的MySQL安装目录下的bin目录,运行winmysqladmin.exe,稍等一会,它会要求您输入用户名与密码(根据您的情况输入)
5、MySQL完成安装

二、J2sdk的安装(以下简称JDK)
1、运行安装文件
2、下一步,同上(选择目录)
3、安装结束后,进入您的JDK安装目录,复制其它路径(如: C:/j2sdk1.4.2)
4、右击“我的电脑”,“属性”,“高级”,“环境变量”,增加一个系统变量,名称:JAVA_HOME 值:上面要求复制的JDK安装目录(我的是: C:/j2sdk1.4.2),确定
5、修改“系统变量path”在其后加一值: 为JDK安装目录下的bin目录,(如: C:/j2sdk1.4.2/bin),确定
6、测试JDK,点击“开始”,“运行”,“cmd”,“java”回车
7、返回信息

插入代码:
以下是引用片段:
C:/Documents and Settings/QiChao>java
Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)

where options include:
-client to select the "client" VM
-server to select the "server" VM
-hotspot is a synonym for the "client" VM [deprecated]
The default VM is client.

-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
A ; separated list of directories, JAR archives,
and ZIP archives to search for class files.
-D<name>=<value>
set a system property
-verbose[:class|gc|jni]
enable verbose output
-version print product version and exit
-showversion print product version and continue
-? -help print this help message
-X print help on non-standard options
-ea[:<packagename>...|:<classname>]
-enableassertions[:<packagename>...|:<classname>]
enable assertions
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
disable assertions
-esa | -enablesystemassertions
enable system assertions
-dsa | -disablesystemassertions
disable system assertions

C:/Documents and Settings/QiChao>


如果你看到以上信息,说明你安装成功啦!

三、Resin的安装

很简单,解压resin-2.1.14.zip解压到你想要的目录

四、虚拟机测试

启动resin目录下的bin/httpd.exe,等待启动结束

访问http://127.0.0.1:8080

如果您看到Resin欢迎页就说明OK了

五、域名的配置

打开conf/resin.conf(记事本方式)

同Tomcat找到...元素,添加一个Host

插入代码:
以下是引用片段:
<!--id 为域名-->
<host id=’www.71i.net’>
<!--文件、目录式配置,这里为项目路径-->
<app-dir>D:/Bluepoint Developers Program/exploded</app-dir>
<!--日志文件,不要可注释-->
<access-log id=’logs/access.log’ format=’%h %l %u %t "%r" %s %b "%{Referer}i" "%{User-Agent}i"’ rollover-period=’1W’/>
<!--出错信息,不要可注释-->
<error-log id=’logs/error.log’/>
<!--class文件路径-->
<classpath id=’WEB-INF/classes’ source=’WEB-INF/classes’ compile=’true’/>
<!--禁止目录访问 打开-->
<directory-servlet>none</directory-servlet>
</host>


这里数据库连接池、SESSION等用户可以在项目中配置

插入代码:

以下是引用片段:
<!--连接池配置方法-->
<resource-ref>
<res-ref-name>jdbc/test</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<init-param driver-name="com.caucho.jdbc.mysql.Driver"/>
<init-param url="jdbc:mysql_caucho://127.0.0.1:3306/test"/>
<init-param user="root"/>
<init-param password="123456"/>
<init-param max-connections="20"/>
<init-param max-idle-time="30"/>
</resource-ref>
六、与Windows Internet信息服务器同步运行

1、建立一个新站点
2、设置主目录到“项目路径”
3、在IIS“ISAPI筛选器”中添加,筛选器名称:scripts 可执行文件: 在“项目目录”下建立一个“scripts”目录,将Resin的libexec下的isapi_srun.dll文件考入其下,选择他为“可执行文件”
4、在此站点下建立一个“虚拟目录”,名称为“scripts”路径为“工程路径”下的“scripts目录”
5、重起IIS,启动Resin,浏览!!!

你将你的域名IP指向你的服务器,OK,指向成功后你访问吧,呵呵!!

此文章由Bluepoint独立完成,转载请注明出处!

插入代码:
以下是引用片段:
2005-12-27 添加以下内容:
上次忘了告诉大家如何在服务器上让他自动运行了:
步骤:开始 ------ 运行 --------- CMD -------- 进入Resin/bin目录 ------ 输入 httpd -install

如:C:/resin 2.1.14/bin>httpd -install
你就会在系统的服务器发现 Resin web server 这个服务

要取消 请输入 httpd - remove

如:C:/resin 2.1.14/bin>httpd -remove
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: