?? rmiclient.java
字號:
/* * RMIClient.java * * Created on 2006年9月14日, 下午2:20 * * To change this template, choose Tools | Options and locate the template under * the Source Creation and Management node. Right-click the template and choose * Open. You can then make changes to the template in the Source Editor. */package simplermi;import java.rmi.*;import java.util.ArrayList;/** * 客戶端程序 * @author jiang */public class RMIClient{ public static void main(String[] args) { //為了測試 固定主機名稱,端口號,命令 String host = "flzhu"; int port = 2200; String cmd = "query"; MyRemoteInterface rmitest1; ArrayList result1=null; try { //通過查找注冊表中的名字獲取遠程對象引用 rmitest1 = (MyRemoteInterface) Naming.lookup("//" + host + ":" + port + "/Manager"); //調用遠程方法 result1=rmitest1.getFromDatabase(cmd); if(result1!=null) { String response=(String)result1.get(0); System.out.println(response); } } catch(Exception nbe) { nbe.printStackTrace(); } } }
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -