| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 660 人关注过本帖
标题:Java RMI 小例子中的问题
只看楼主 加入收藏
chpfeng
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2006-3-23
收藏
 问题点数:0 回复次数:0 
Java RMI 小例子中的问题

第一次编写Java RMI 方面的程序,遇到了一些小问题,请给于指点!谢谢!

以下是程序片断:

import java.io.*;
import java.rmi.server.*;
import java.rmi.Remote;
import java.rmi.Remote.*;
import java.rmi.registry.*;
import java.net.*;

public class PerfectTime extends Remote{
public long getPerfectTime()throws RemoteException{
return System.currentTimeMills();
}
public PerfectTime() throws RemoteException{
super();
}
public static void main(String []args) throws Exception {
System.setSecurityManager(new RMISecurityManager());
PerfectTime pt=new PerfectTime();
Naming.bind("//wyc:8080//PerfectTime",pt);
System.out.println("Ready to do time!");
}
}


编译后结果:
PerfectTime.java:8: 此处不需要接口
public class PerfectTime extends Remote{
^
PerfectTime.java:9: 找不到符号
符号: 类 RemoteException
位置: 类 PerfectTime
public long getPerfectTime()throws RemoteException{
^
PerfectTime.java:12: 找不到符号
符号: 类 RemoteException
位置: 类 PerfectTime
public PerfectTime() throws RemoteException{
^
PerfectTime.java:10: 找不到符号
符号: 方法 currentTimeMills()
位置: 类 java.lang.System
return System.currentTimeMills();
^
PerfectTime.java:16: 找不到符号
符号: 类 RMISecurityManager
位置: 类 PerfectTime
System.setSecurityManager(new RMISecurityManager()
^
PerfectTime.java:18: 找不到符号
符号: 变量 Naming
位置: 类 PerfectTime
Naming.bind("//wyc:8080//PerfectTime",pt);
^
6 错误



2006-03-24 15:33
快速回复:Java RMI 小例子中的问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.018170 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved