尝试生成存根文件时出错

时间:2012-02-14 11:06:02

标签: java rmi stub

当我尝试使用以下代码生成存根文件时:rmic RemoteMethodImpl 我收到以下错误:

error: File .\RemoteMethodImpl.class does not contain type RemoteMethodImpl as expected, but type InterfaceImplementation.RemoteMethodImpl. Please remove the file, or make sure it appears in the correct subdirectory of the class path.
error: Class RemoteMethodImpl not found.
2 errors

这是什么错误?为什么我会这样做?

应@ Shashank Kadne的要求

package InterfaceImplementation;
import Interfaces.RemoteMethodIntf;
import java.rmi.server.UnicastRemoteObject;
import java.rmi.RemoteException;
import Design.Main_Design_Client;
/**
 *
 * @author program-o-steve
 */
 public class RemoteMethodImpl extends UnicastRemoteObject implements RemoteMethodIntf{
  public RemoteMethodImpl() throws Exception{}   

@Override
public void send(String IP,String Message) throws RemoteException {
  Main_Design_Client mdc = new Main_Design_Client();
  mdc.jTextArea1.setText("<html><b>Message from :</b></html>" + IP);
  mdc.jTextArea1.setText("<html><b>Message :</b></html>" + Message);
}

}

3 个答案:

答案 0 :(得分:3)

我假设你在一个目录外面&#34; InterfaceImplementation&#34;文件夹中。

执行:rmic InterfaceImplementation.RemoteMethodImpl

答案 1 :(得分:2)

是的,我正在尝试

% rmic GumballMachine

但从

读取后发生了变化
% rmic gumball\GumballMachine

%rmic gumball.GumballMachine

工作正常。有时候,我想知道我是个笨蛋!!

答案 2 :(得分:0)

  

当我尝试生成存根文件

停在那儿。你大约八年没有这么做了。

  

public RemoteMethodImpl()抛出异常{}

只需更改即可调用super(),您根本不需要存根。请参阅Javadoc的序言java.rmi.server.UnicastRemoteObject