📄 安装配置aglet平台.txt
字号:
http://blog.chinaunix.net/u/17663/showart.php?id=413424
Agent和JADE,Jadex研究QQ群:
24893770
46440672
欢迎讨论,但实践中的问题需要自己多动手和通过官方的maillist去解决。
作者:aglet( 4469206)
终于成功安装配置aglet平台作者:六壁居士 提交日期:2007-8-20 19:54:00 | 分类: | 访问量:132
折磨了我一个晚上加半个白天的安装配置问题,终于解决了。
原来的问题是一直无法生成.keystore这个文件,导致总是build失败,现在的解决过程如下:
将aglet2.0.2版解压在e:\aglet里面,JDK5.0(包括JRE)安装在D:\java里面,环境变量(都在那个“hdwang的用户变量”窗口里面设置,其中hdwang为我的操作系统登录用户名)设置为:
AGLET_HOME=e:\aglet
AGLET_PATH=e:\aglet\public
ANT_HOME=e:\aglet
JAVA_HOME=d:\java
CLASSPATH=.;%JAVA_HOME%\lib;%JAVA_HOME%\jre\lib;e:\aglet;e:\aglet\public;e:\aglet\lib;e:\aglet\bin
path=C:\Program Files\Microsoft Visual Studio\Common\Tools\WinNT;C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin;C:\Program Files\Microsoft Visual Studio\Common\Tools;d:\Program Files\Microsoft Visual Studio\VC98\bin;%JAVA_HOME%bin;%JAVA_HOME%lib;%JAVA_HOME%jre;e:\aglet;e:\aglet\bin;e:\aglet\lib
注意路径设置好了之后,重启计算机才起了作用,
然后在dos界面下的e:\aglet\bin下面运行命令ant,显示信息如下:
///////////////////////////此行为自加的分界线//////////////////////////////////////
Microsoft Windows XP [版本 5.1.2600]
(C) 版权所有 1985-2001 Microsoft Corp.
C:\Documents and Settings\hdwang>e:
E:\>cd aglet
E:\aglet>cd bin
E:\aglet\bin>ant
Buildfile: build.xml
info:
[echo]
*** READ ME *** READ ME *** READ ME *** READ ME ***
In order to run the Aglet Server, you need to update
C:\Documents and Settings\hdwang/.java.policy with the grant entry
found in E:\aglet\bin/.java.policy.
You can simply place the .java.policy file in C:\Documents and Settings\hdwang.
The server also needs a java .keystore file. One has been provide
for you in this directory. The password is "aglets" (without quotes).
It contains a key for the server "aglet_key", and a key for an anonymous
user "anonymous". To use the keystore, copy it to C:\Documents and Settings\hdw
ang.
WARNING: This keystore is not meant to be secure! It is
intended to get new users running easily.
To install both of these files into your home directory
run the command: "ant install-home" (no quotes)
*** READ ME *** READ ME *** READ ME *** READ ME ***
install:
[copy] Copying 4 files to E:\aglet\bin
grant:
keystore:
[genkey] Generating Key for aglet_key
[exec] The command attribute is deprecated. Please use the executable attri
bute and nested arg elements.
[genkey] Generating Key for anonymous
[exec] The command attribute is deprecated. Please use the executable attri
bute and nested arg elements.
all:
BUILD SUCCESSFUL
Total time: 2 seconds
E:\aglet\bin>
////////////////////////////此行为自加的分界线//////////////////////////////
此时,在C:\Documents and Settings\hdwang里面(hdwang是我的机器对应的用户名)已经有了两个关键文件之一的.java.policy ,但是另一个关键文件.keystore却没有复制进来,只能手动复制进来(大概看了一下ant同目录下的build.xml,似乎是有做复制的代码的,但不知道为什么没成功,有空再看看)。在把e:\aglet\bin下面名字分别为.java.policy和.keystore的两个文件都复制到了C:\Documents and Settings\hdwang之后,再在E:\aglet\bin>下运行agletsd命令,千呼万唤的Tahiti平台终于出来了,默认的登录用户名显示为hdwang。这时候该用什么帐号登录呢?再看build.xml文件里有一段代码是: ,于是使用aglet_key为用户名,aglets为密码登录,才可以成功登录。据说要设置自己的用户名和密码可以通过keytool工具对.keystore文件进行修改(keytool是java安装目录下的bin目录下的一个可执行文件)。
安装配置好后,会发现在C:\Documents and Settings\hdwang下面生成一个名为.aglets的文件夹,里面只有一个名为security的子文件夹,该子文件夹里面有名为aglets.policy和sample.policy的两个文件,看里面的英文注解它们两个是属于Aglets Security Policy File。在登录了Tahiti之后,C:\Documents and Settings\hdwang会生成一个空的spool文件夹和非空的users文件夹,users里面仅有一个子文件夹aglet_key,aglet_key里面有3个大小为0的文件,名字分别为:aglets.properties、atp.properties和tahiti.properties。 实际上,在运行agletsd后,控制台界面就显示有下面这段信息:
E:\aglet\bin>agletsd
Aglets Policy File does not exist.
Aglets Policy File is created.
[C:\Documents and Settings\hdwang\.aglets\users\aglet_key\aglets.properties is n
ot found. Creating new file.]
[C:\Documents and Settings\hdwang\.aglets\users\aglet_key\atp.properties is not
found. Creating new file.]
[Warning: The hostname seems not having domain name.
Please try -resolve option to resolve the fully qualified hostname
or use -domain option to manually specify the domain name.]
[C:\Documents and Settings\hdwang\.aglets\users\aglet_key\tahiti.properties is n
ot found. Creating new file.]
最后在下面记录一些其它资料上说到的一些注解和举例,有些错误的地方我订正了,后面也许有用:
(1)aglet 2.0.2 涉及到的主要的相关文件有:
C:\Documents and Settings\a\.keystore and .java.policy (假设OS登录用户名是a)
C:\Documents and Settings\a\.aglets\security\aglet.policy
C:\aglet-2.0.2\cnf\aglet.props
说明:
aglet.props 是aglet系统配置文件,用作在启动aglet时读取;
在aglet.props文件中重要的设置项目有:
user.home
maf.protocol
maf.port
aglet.class.path
aglet.secure
aglet.startup
aglet.owner.name
aglet.owner.password
aglet.keystore.password
aglet.policy 是aglet的安全策略文件,在tahiti服务器中option-->security preference中进行设置。
.java.policy 是java用户安全策略文件,使用java工具policytool 进行设置(位置在java安装目录的bin文件夹下)
.keystore 是用于为aglet建立新用户/密码的,可以使用java工具keytool设置(位置同上)
(2)运行命令举例:
agletd
直接启动Tahiti服务器, 会出现登录窗口, 要求输入用户名和密码,可以使用系统提供的默认用户名和密码, 也可以使用用户自定义的用户名和密码。(要设置自己的用户名和密码可以通过keytool工具对.keystore文件进行修改);
agletd –f c:\aglet-2.0.2\cnf\aglet.props
通过要求读配置文件aglet.props,来启动Tahiti服务器,这种方式要求用户首先应对aglet.props文件进行配置,该文件位置在c:\aglet-2.0.2\cnf\ , 在文件中可以对用户名和其密码,以及安全性, 运行端口等多项进行设置, 使用户更能根据自身需要灵活使用aglet平台 ;
agletd -f c:\aglet-2.0.2\cnf\aglet.props -port 2000
功能同上例,在启动时指定运行的端口,默认情况下为4434,使用不同的端口,用户可以在一台机器上同时运行多个Tahiti服务器。
(3)程序的编写、编译与执行步骤
a、程序的编写
这里给出一个简单的例子:
package trial;
import com.ibm.aglet.*;
public class MyAglet extends Aglet
{
public void run()
{
System.out.println("Hello, world!");
}
}
b、程序的编译
生成的.class文件默认情况下要放在:
C:\aglet-2.0.2\public 目录下才能执行。
可以在编译的时候就将.class存放在该位置:
编译命令举例:
javac xxx.java -d C:\aglet-2.0.2\public
c、程序的执行
启动Tahiti,指明Aglet 为trial.MyAglet,运行结果是在屏幕上显示”Hello,world! ”
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -