我正在盯着学习java中的RMI,我正在使用Netbeans 7.0.1。我创建了一个基本的接口使用netbeans的基本RMI
package helloclass;
import java.rmi.*;
public interface HelloInterface extends Remote
{
public String hello() throws RemoteException;
}
这是一个实现该接口
package helloclass;
import java.rmi.*;
import java.rmi.server.UnicastRemoteObject;
public class HelloClass extends UnicastRemoteObject implements HelloInterface
{
private String message;
public HelloClass() throws RemoteException{}//constructor throwing RemoteException
public String hello() throws RemoteException //method throwing RemoteException
{
return "Saying hello";
}
public static void main(String[] args)
{
}
}
在我的理解我现在需要建立这两个类,然后运行在命令提示符下rmic
命令的类。
如何在命令提示符下使用netbeans?运行此rmic
命令。 我一直在尝试转到项目属性,然后在运行后的VM选项中输入rmic
,然后指定HelloClass.class
所在的目录,但似乎无法找到该类。
早上好为谁?也许是晚上在这里,你怎么知道的:)? – Juvanis 2012-03-04 09:42:52
这可能是你想要的:http://docs.oracle.com/javase/tutorial/rmi/implementing.html – luketorjussen 2012-03-04 09:45:00