动态网站制作指南 [  QQ表情  ]
[ 投票调查 ]
[ 企业邮箱 ]
[ 网站空间 ]
网络编程 | 站长之家 | 网页制作 | 图形图象 | 操作系统 | 冲浪宝典 | 软件教学 | 网络办公 | 邮件系统 | 网络安全 | 认证考试 | 系统进程
ASP源码 | .Net源码 | PHP源码 | JSP源码 | JAVA源码 | CGI源码 | VB源码 | C++源码 | Delphi源码 | PB源码 | VF源码 | 汇编 | 服务器
Firefox | IE | Maxthon | 迅雷 | 电驴 | BitComet | FlashGet | QQ | QQ空间 | Vista | 输入法 | Ghost | Word | Excel | wps | Powerpoint
asp | .net | php | jsp | Sql | c# | Ajax | xml | Dreamweaver | FrontPages | Javascript | css | photoshop | fireworks | Flash | Cad | Discuz!
当前位置 > 网站建设学院 > 网络编程 > Java教程
Tag:注入,存储过程,分页,安全,优化,xmlhttp,fso,jmail,application,session,防盗链,stream,无组件,组件,md5,乱码,缓存,加密,验证码,算法,cookies,ubb,正则表达式,水印,索引,日志,压缩,base64,url重写,上传,控件,Web.config,JDBC,函数,内存,PDF,迁移,结构,破解,编译,配置,进程,分词,IIS,Apache,Tomcat,phpmyadmin,Gzip,触发器,socket
网络编程:ASP教程,ASP.NET教程,PHP教程,JSP教程,C#教程,数据库,XML教程,Ajax,Java,Perl,Shell,VB教程,Delphi,C/C++教程,软件工程,J2EE/J2ME,移动开发
文章搜索服务
邮件订阅
输入你的邮件地址,
你将不会错过任何关于:
[ Java教程 ]的信息

本月文章推荐
.Java模式开发之责任链模式(上).
.分析Hibernate的事务处理机制.
.在Weblogic上配置Hibernate为JND.
.开发webservice应用程序.
.Struts模块化编程经典实战教程(一.
.常见的十四种Java开发工具及其特.
.Java.util包简介并教您如何开发应.
.在MIDP应用程序中播放声音.
.JAVA认证问答.
.Java 数据对象(JDO)介绍(二).
.教你如何配置安全的SOLARIS系统.
.用Java 接口实现回调函数的等价功.
.详解用J2EE架构企业级应用.
.Adapter在J2SE事件处理中的应用.
.最大化J2EE和数据库交互操作的性.
.Sun力推JDS数据库计划 开拓数据库.
.Struts Controller.
.java性能优化-之二.
.VBArray 对象.
.[webservices开发]XFire在Spring.

我的RMI实践

发表日期:2008-1-5 |



  //: c15:rmi:PerfectTime.Java
  // From 'Thinking in Java, 2nd ed.' by BrUCe Eckel
  // www.BruceEckel.com. See copyright notice in CopyRight.txt.
  // The implementation of
  // the PerfectTime remote object.
  import java.rmi.*;
  import java.rmi.server.*;
  import java.rmi.registry.*;
  import java.net.*;
  
  public class PerfectTime
  extends UnicastRemoteObject
  implements PerfectTimeI {
  // Implementation of the interface:
  public long getPerfectTime()
  throws RemoteException {
  return System.currentTimeMillis();
  }
  // Must implement constructor
  // to throw RemoteException:
  public PerfectTime() throws RemoteException {
  // super(); // Called automatically
  }
  // Registration for RMI serving. Throw
  // exceptions out to the console.
  public static void main(String[] args) throws Exception {
  PerfectTime pt = new PerfectTime();
  Naming.rebind("/PerfectTime", pt);
  System.out.println("Ready to do time");
  }
  } ///:~
  //: c15:rmi:PerfectTimeI.java
  // From 'Thinking in Java, 2nd ed.' by Bruce Eckel
  // www.BruceEckel.com. See copyright notice in CopyRight.txt.
  // The PerfectTime remote interface.
  import java.rmi.*;
  
  interface PerfectTimeI extends Remote {
  long getPerfectTime() throws RemoteException;
  } ///:~
  //: c15:rmi:DisplayPerfectTime.java
  // From 'Thinking in Java, 2nd ed.' by Bruce Eckel
  // www.BruceEckel.com. See copyright notice in CopyRight.txt.
  // Uses remote object PerfectTime.
  import java.rmi.*;
  import java.rmi.registry.*;
  
  public class DisplayPerfectTime {
  public static void main(String[] args)
  throws Exception {
  System.setSecurityManager(
  new RMISecurityManager());
  PerfectTimeI t = (PerfectTimeI)Naming.lookup("/PerfectTime");
  for(int i = 0; i < 10; i++)
  System.out.println("Perfect time = " +
  t.getPerfectTime());
  }
  } ///:~
  grant {
  // Allow everything for now
  permission java.security.AllPermission;
  };
  
  存入于F:\rmi下
  操作步骤
  F:\rmi>java PerfectTime
  Ready to do time
  F:\rmi>javac *.java
  F:\rmi>rmic PerfectTime
  F:\rmi>start rmiregistry
  F:\rmi>java PerfectTime
  Ready to do time
  另开一DOS窗口
  F:\rmi>java -Djava.security.policy=registerit.policy DisplayPerfectTime
  Perfect time = 1011585443953
  Perfect time = 1011585443968
  Perfect time = 1011585444000
  Perfect time = 1011585444000
  Perfect time = 1011585444015
  Perfect time = 1011585444031
  Perfect time = 1011585444031
  Perfect time = 1011585444046
  Perfect time = 1011585444062
  Perfect time = 1011585444062
  注重:假如在rmic PerfectTime时报找不到PerfectTime类,请在环境变量中的ClassPath中加入:F:\rmi
上一篇:用RMI编写实时聊天程序 人气:515
下一篇:简析Java RMI 与 .NET Remoting 人气:411
浏览全部Java的内容 Dreamweaver插件下载 常用网页广告代码全集
  最新网站源码 最新软件下载
2008-8-29 oblog v4.6 build 20080827
2008-8-29 ASBLOG v2.5 bulid 080828
2008-8-29 时尚DJ舞曲小偷 v3.1
2008-8-29 仿代码信息分类系统 v1.0 Beta3
2008-8-29 浮梦呓语-个人网站 完整版
2008-8-29 多用户QQ空间Flash播放器
2008-8-29 美思卡企业网站管理系统高级版
2008-8-28 LDV个人相册系统 v1.6.1
2008-8-28 讯时网站管理系统CMS v3.5
2008-8-23 Mini WinMount V0.4
2008-8-23 Vista优化大师3.11正式版
2008-8-23 Wine 1.13
2008-8-23 KlipFolio 5.0 Build 5899-80
2008-8-23 Windows Sysinternals Desktops
2008-8-23 OneTap Movies1.2破解版
2008-8-23 AnnotaterPDF阅读1.1.503 破解版
2008-8-23 SoundMeter分贝测量仪 v1.0汉化破
2008-8-23 iDrum音乐节拍1.0破解版
  发表评论
姓 名: 验证码:
内 容:
站长工具:网站收录查询 | Google PR查询 | ALEXA排名查询 | CSS在线编辑器 | 广告代码 | Html转换js | js/vbs加密 | md5加密 | 进制转换
实用工具:汉字翻译拼音 | 符号对照表 | 个税计算 | 经典小工具 | 汉字简繁转换 | 普通单位换算 | 公制单位换算 | 生辰老黄历 | 国内电话区号 国家代码与域名缩写 | 文字加密解密 | 健康查询 | 万年历 | 汉字横竖排版 | 手机号码查询 | 计算器 | ip搜索
业务联系 | 广告刊登 | 频道合作 | 投稿荐稿 | 联系方式 | 加入收藏 | RSS订阅
Copyright © 2000-2008 www.knowsky.com All rights reserved | 网络实名:动态网站制作指南 | 沪ICP备05001343号
ホームページ制作 不動産検索システム 求人情報
防水工事·改修工事 フットサル大会 探偵