}
int port =new Integer(args[1]).intValue();
Registry reg=null;
if(args[0].equals("true")) {
reg=LocateRegistry.createRegistry(port);
System.out.println("Successfully created registry");
}
else {
reg=LocateRegistry.getRegistry(port);
System.out.println("Connected to existing registry.");
}
Flip flip=new Flip(reg);
}
public Flip(Registry reg) throws Exception,RemoteException {
super();
reg.rebind("Flip",this);
System.out.println("Flip object bound");
}
public int flip(int i) throws RemoteException {
return i*-1;
}
}报错:
symbol  : class IFlip
location: class com.wiley.compBooks.roman.rmi.flip.Flip
public class Flip extends UnicastRemoteObject implements IFlip {
                                                         ^
1 error
救命!

解决方案 »

  1.   

    编译不过阿,帮我编译它!环境变量绝对没问题!    .;c:\jdk1.4.0\lib;c:\j2sdkee1.3.1\lib\j2eetools.jar;
    ???
      

  2.   

    需要的接口包没有在classpath里面,导入,编译.
      

  3.   

    是rmi.zip吗,它在c:\jdk1.4.0\lib 里面了,还需要别的什么吗?
      

  4.   

    是 interface 有什么关系吗?
      

  5.   

    package com.wiley.compBooks.roman.rmi.flip;import java.rmi.*;
    import java.rmi.server.*;
    import java.rmi.registry.*;interface IFlip extends Remote 
    {
    public int flip(int i) throws RemoteException;
    }public class Flip extends UnicastRemoteObject implements IFlip 
    { public static void main(String[] args) 
    {
    if(args.length!=2) 
    {
    System.err.println("Syntax: Flip<true|false><port>");
    System.err.println();
    System.err.println("true demarcates to start RMI Registry, "+
    "false demarcates to bind to existing one.");
    System.err.println("port is the port # for RMI Registry.");
    System.exit(-1);
    }
    int port =new Integer(args[1]).intValue();
    Registry reg=null;
    if(args[0].equals("true")) 
    {
    try
    {
    reg = LocateRegistry.createRegistry(port);
    }
    catch(Exception e)
    {
    }
    System.out.println("Successfully created registry");
    }
    else 
    {
    try
    {
    reg = LocateRegistry.getRegistry(port);
    }
    catch(Exception e)
    {
    System.out.println("Connected to existing registry.");
    }
    }
    try
    {
    Flip flip=new Flip(reg);
    }
    catch(Exception e)
    {
    }
    }
    public Flip(Registry reg) throws Exception,RemoteException 
    {
    super();
    reg.rebind("Flip",this);
    System.out.println("Flip object bound");
    }
    public int flip(int i) throws RemoteException {
    return i*-1;
    }
    }你把这个试一下其实你刚才也可以编译的,不过你的classpath中要包含这个文件的路径外还有你需要catch一些一定需要捕捉的exception 
      

  6.   

    我想知道为什么在同一个目录下,IFlip.class 接口类不能被Flip.java 所用。