JBuilder CORBA Applet實做
準備工作:
軟件
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@]