⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 setup.java

📁 书籍《JAVA面向对象程序设计》书籍的课后源代码。相信对很多人都有帮助
💻 JAVA
字号:
///////    Setup.java    ///////
package myrmi.demo; 

import java.rmi.*;
import java.rmi.activation.*;
import java.util.Properties;


public class Setup
{
   public static void main(String args[])
                 throws Exception
   {  // Create and install a security manager 
      System.setSecurityManager(new RMISecurityManager()); 

      Properties props = new Properties(); 
      props.put("java.security.policy", path + "policy");

      ActivationGroupDesc.CommandEnvironment ace = null; 
      ActivationGroupDesc gd = new ActivationGroupDesc(props, ace);

      ActivationGroupID agi = 
         ActivationGroup.getSystem().registerGroup(gd);

      String location = "file:" + path;

      MarshalledObject data = null;
      ActivationDesc desc = new ActivationDesc 
           (agi, "myrmi.demo.FactorialImpl", 
            location, data);
      
      // Register with rmid
      //
      Factorial mri = (Factorial)Activatable.register(desc);
      System.out.println("Got the stub for the FactorialImpl");
      
      // Bind the stub to a name in the registry running on 1099
      // 
      Naming.rebind("FactorialServer", mri);
      System.out.println("Exported FactorialServer");

      System.exit(0);
   } 
   
   static String path = "/root/jvb2/source/11/ex/myrmi/demo/";
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -