尝试生成存根文件时出错
当我尝试使用: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);
}
}
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);
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我假设您位于“InterfaceImplementation”文件夹之外的目录中。
执行:rmic InterfaceImplementation.RemoteMethodImpl
I am assuming you are in a directory just outside "InterfaceImplementation" folder.
Execute :
rmic InterfaceImplementation.RemoteMethodImpl
是的,我正在尝试
,但在阅读后改变了,
效果
很好。有时候,我都在想,我到底是个多么傻的人啊!!
Yes, I was trying
but changed after reading it from
to
which works fine. Sometimes, I wonder what a blockhead I am!!
就停在那里。大约八年以来你都不需要这样做了。
只需将其更改为调用
super()
,您就根本不需要存根。请参阅java.rmi.server.UnicastRemoteObject
的 Javadoc 前言。Stop right there. You haven't needed to do that for about eight years.
Just change that to call
super()
and you won't need a stub at all. See the preamble to the Javadoc forjava.rmi.server.UnicastRemoteObject
.