尝试生成存根文件时出错

发布于 2025-01-05 23:52:36 字数 1155 浏览 0 评论 0原文

当我尝试使用: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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

烟若柳尘 2025-01-12 23:52:36

我假设您位于“InterfaceImplementation”文件夹之外的目录中。

执行:rmic InterfaceImplementation.RemoteMethodImpl

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

Execute : rmic InterfaceImplementation.RemoteMethodImpl

窗影残 2025-01-12 23:52:36

是的,我正在尝试

% rmic GumballMachine

,但在阅读后改变了,

% rmic gumball\GumballMachine

效果

%rmic gumball.GumballMachine

很好。有时候,我都在想,我到底是个多么傻的人啊!!

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!!

谁把谁当真 2025-01-12 23:52:36

当我尝试生成存根文件时

就停在那里。大约八年以来你都不需要这样做了。

public RemoteMethodImpl() 抛出异常{}

只需将其更改为调用 super() ,您就根本不需要存根。请参阅 java.rmi.server.UnicastRemoteObject 的 Javadoc 前言。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文