java rmi
刚学习了rmi,照着书上抄了一遍,可是报出异常,实在不知道怎么解决
Java code:
public interface HelloService extends Remote {
public String echo(String msg) throws RemoteException;
public Date getTime() throws RemoteException;
}
Java code:
public class HelloServiceImpl extends UnicastRemoteObject implements
HelloService {
private String name;
public HelloServiceImpl(String name) throws RemoteException {
this.name = name;
}
public String echo(String msg) throws RemoteException {
System.out.println(name + ":use the echo() method");
return "echo:" + msg + "from" + name;
}
public Date getTime() throws RemoteException {
System.out.println(name + ":use the getTime() method");
return new Date();
}
}
Java code:
public class SimpleServer1 {
public static void main(String[] args) {
try {
HelloService service1 = new HelloServiceImpl("service1");
HelloService service2 = new HelloServiceImpl("service2");
相关问答:
我在jsp页面存上一个session,本页面还可以取出值来.
但是一刷新,或者打开新的页面就取不出值来了.
奇怪的是,我测试另一个程序时候
在jsp页面存上一个session,本页面可以取出值来,刷新或打开新页面值能取出来了.
......
import java.io.*;
class FileTest
{
public static void main(String [] args) throws Exception
{
File fDir=new File(File.separator);
String strFile="java源代码测试"+File.separato ......
我的java applet 嵌入html后无法显示,而用appletviewer显示正常为什么,还有就是用html converter转化后可以显示,为什么?请大侠赐教!
HTML code:
<HTML>
<HEAD>
<TITLE>TEST.HTML< ......
public class Student{
//字段的定义
private String _number; //学号
private String _name; //姓名
private   ......