问题
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