准备工作:
软件
JB4E,JDK1.2,jre-1_2_2_005-win.exe(PlugIn1.2.2_005),Win2000P,IE5
安装及设置
JDK1.2
JB4E及所带的AppServer4.1,并确保已经能做CORBA程序了(JB 
IDE配置正确)
用RegSvr32/u 
…beans.ocx卸掉已有的PlugIn,以防干扰。beans.ocx文件所在的目录可用regedit来在注册表中查看。
开始:
1.New一个Project并设置你的Project的JDK指向1.2
2.书写以下IDL
module 
Module1 {
interface Interface1 {
long 
operation1();
};
};
3.生成Server并实现。这里让实现代码如下:
public int 
operation1() {
ServerMonitor.log("(" + _name + ")Interface1Impl.java 
operation1()");
return 
(int)System.currentTimeMillis();
}
粗体字为所输入代码
4.生成一个Applet,加一个jButton和一个jLabel并让局部代码如下:
public 
class Applet1 extends JApplet {
private untitled1.Module1.Interface1 
_interface1;
String _name = "Interface1";
/**Initialize the 
applet*/
public void init() {
try {
jbInit();
org.omg.CORBA.ORB orb 
= org.omg.CORBA.ORB.init(this, null);
_interface1 = 
untitled1.Module1.Interface1Helper.bind(orb, "/" + _name + "_poa", 
_name.getBytes());
…
void jButton1_actionPerformed(ActionEvent e) 
{
jLabel1.setText(new 
Integer(_interface1.operation1()).toString());
}
5.编译并打包
6.用以下命令启动AppServer
ias 
?javahome c:jbuilder4jdk1.3 
7.在IDE中启动Server
8.启动一个dos 
command窗口,进入以下目录
cd 
inpriseappserverhtmlpublic_html
9.拷贝以下文件到该目录下
untitled1.jar
vbjorb.jar
Applet1.html
jre-1_2_2_005-win.exe
10.修改Applet1.html为Applet2.html,如下
HTML 
Test 
Page
untitled1.Applet1 
will appear below in a Java enabled browser.
CODEBASE 
= "."
archive="vbjorb.jar , untitled1.jar"
CODE = 
"untitled1.Applet1.class"
NAME = "TestApplet"
WIDTH = 400
HEIGHT = 
300
HSPACE = 0
VSPACE = 0
ALIGN = middle
>
11.修改Applet1.html为Applet3.html,如下
HTML 
Test 
Page
untitled1.Applet1 
will appear below in a Java enabled browser.
WIDTH = 400 
HEIGHT = 
300 
NAME = "TestApplet" 
ALIGN = middle 
VSPACE = 0 
HSPACE = 0 
codebase="http://127.0.0.1:8080/jre-1_2_2_005-win.exe#Version=1,2,2,0">
粗体字(IP地址)可以为13步中所显示的值
12.在该目录下执行
start 
gatekeeper
13.执行以下程序,记下其中的IP地址
printior 
gatekeeper.ior
14.执行以下程序观察运行结果
jdk1.2inappletviewer 
http:/…:8080/Applet2.html
其中URL主机地址为上一步所看到的IP地址
15.在IE5中输入以下URL,观察运行结果
http://…:8080/Applet3.html
其中URL主机地址为13步中所看到的IP地址
怎么样?是不是看到太阳升起来了? [@more@]