error while trying to generate stub file

家住魔仙堡 提交于 2020-05-16 20:04:46

问题


When i try to generate a stub file using :rmic RemoteMethodImpl I get the following error :

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

What error is this ? Why do i get this ?

Upon the request of @ 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);
}

}


回答1:


I am assuming you are in a directory just outside "InterfaceImplementation" folder.

Execute : rmic InterfaceImplementation.RemoteMethodImpl




回答2:


Yes, I was trying

% rmic GumballMachine

but changed after reading it from

% rmic gumball\GumballMachine

to

%rmic gumball.GumballMachine

which works fine. Sometimes, I wonder what a blockhead I am!!




回答3:


When i try to generate a stub file

Stop right there. You haven't needed to do that for about eight years.

public RemoteMethodImpl() throws Exception{}

Just change that to call super() and you won't need a stub at all. See the preamble to the Javadoc for java.rmi.server.UnicastRemoteObject.



来源:https://stackoverflow.com/questions/9275782/error-while-trying-to-generate-stub-file

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!