Listing 2. PrinterServerActivatable.java

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

public class PrinterServerActivatable{

  public static void main(String[] args)
      { 
      try{
         //setting a security manager 
         Properties sys_prop=System.getProperties(); 
         sys_prop.put("java.security.policy","12.policy");      
         System.setSecurityManager(new RMISecurityManager());                      
         

//creating an activation group
ActivationGroupDesc.CommandEnvironment AGD=null; 
ActivationGroupDesc group=new ActivationGroupDesc(sys_prop,AGD);
ActivationGroupID AGid=ActivationGroup.getSystem().registerGroup(group);
ActivationGroup.createGroup(AGid,group,0);

System.out.println("Activation group successfully created...");

//the path to the class corresponding to the activable remote object
String url=" file:///C://Data_Local//RMIServerActivation//";

//initialization information
MarshalledObject data=new MarshalledObject(new File(".//Init.txt")); 

//creating the corresponding ActivationDesc object for getting the stub
ActivationDesc AD=new ActivationDesc("PrinterImplActivatable",url,data); 
PrinterInterface stub=(PrinterInterface)Activatable.register(AD);

System.out.println("The stub was successfully obtain...");

//register the activable remote object to the rmiregistry
Naming.rebind("printer",stub); 
System.out.println("The activable remote object was successfully registered to rmiregistry...");

//force the exit
System.exit(0); 

   }catch(Exception e)
     {
     Throwable T=e.getCause();
     System.out.println(T.getMessage());
     }                                             
   }
}

How to Add Java Applets to Your Site

New on the Java Boutique:

New Review:

Time Management Made Easy with the Quartz Enterprise Job Scheduler
Why not just use the Java timer API? This open source scheduling API boasts simplicity, ease-of-integration, a well-rounded feature set, and it's free!

New Applet:

Reverse Complement
Reverse Complement is a simple applet that converts DNA or RNA sequences into three useful formats.

Elsewhere on internet.com:

WebDeveloper Java
Lots of Java information on webdeveloper.com

WDVL Java
Thorough Java resource at the Web Developer's Virtual Library.

ScriptSearch Java
Hundreds of free Java code files to download.

jGuru: Your View of the Java Universe
Customizable portal with online training, FAQs, regular news updates, and tutorials.