📄 helloworldservice.java
字号:
//http://www.sun.com/software/communitysource/j2me/
import java.rmi.*;
import java.rmi.server.UnicastRemoteObject;
public class HelloWorldService extendx UnicastRemoteObject implements HelloWorldInterface,Serializable
{
public HelloWorldService() throws RemoteException
{
super();
}
public String getHelloWorld()
{
String retStr = null;
if(System.getSecurityManager()=null)
{
System.setSecurityManager(new RMISecurityManager());
}
return retStr;
}
public static void main(String args[])
{
if(System.getSecurityManager()=null)
{
System.setSecurityManager(new RMISecurityManager());
}
try
{
HelloWorldService hws = new HelloWorldService();
Naming.rebind("//hostName/HelloWorldService",hws);
}
catch(Exception e)
{
e.printStackTrace();
}
}
public interface HelloWorldInterface extends Remote
{
public String getHelloWorld() throws RemoteException;
}
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -