【Java开源代码栏目提醒】:网学会员,鉴于大家对Java开源代码十分关注,论文会员在此为大家搜集整理了“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;
}
};
上一篇:
HelloWorldPersonal.java
下一篇:
AF内固定椎体内植骨治疗胸腰椎骨折