StartRmiServer.java.txt
上传用户:aonuowh
上传日期:2021-05-23
资源大小:35390k
文件大小:2k
- /* $Id: StartRmiServer.java,v 1.2 2001/10/04 12:42:37 ram Exp $ */
- import java.io.*;
- public class StartRmiServer
- {
- public static void main(String [] args) {
- Process process ;
- Runtime rt;
-
- try
- {
- String command =null;
- String command1 =null;
- if( System.getProperty("os.name").endsWith("95"))
- {
- command = "command.com /c "+"rmiregistry";
- command1 = "command.com /c "+"java -Djava.security.policy=SNMPRmi.policy com.adventnet.snmp.rmi.SnmpFactoryImpl";
- }
- else if( System.getProperty("os.name").endsWith("NT"))
- {
- command = "cmd /c "+"rmiregistry";
- command1 = "cmd /c "+"java -Djava.security.policy=SNMPRmi.policy com.adventnet.snmp.rmi.SnmpFactoryImpl";
- }
- else
- {
- command = "rmiregistry";
- command1 = "java -Djava.security.policy=SNMPRmi.policy com.adventnet.snmp.rmi.SnmpFactoryImpl";
- }
- process = Runtime.getRuntime().exec(command);
- // wait for some time till the RMI Registry is done.
- try {
- Thread.sleep(1000);
- } catch (Exception e) {
- System.out.println ("Caught exception:" + e.getMessage());
- }
- System.out.println ("Started RMI Registry");
- // Start the SNMP RMI Factory Impl.
- process = Runtime.getRuntime().exec(command1);
- System.out.println ("Started SNMP RMI Factory Impl. Waiting for requests from RMI Clients");
-
- }
- catch(java.lang.SecurityException se)
- {
- System.out.println("RMI Server startup unsuccessfull:"+ se.toString());
- }
- catch(IOException ex)
- {
- System.out.println("RMI Server startup unsuccessfull:"+ ex.toString());
- }
- }
- }
-