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

📄 sampleclient.java

📁 java rmi例子
💻 JAVA
字号:
//---------------------------------------------------------------// File: SampleClient.java//---------------------------------------------------------------import java.rmi.*;import java.rmi.server.*;public class SampleClient  {   public static void main(String[]  args)   {      // set the security manager for the client      System.setSecurityManager(new RMISecurityManager());      //get the remote object from the registry      try        {          System.out.println("Security Manager loaded");          String url = "//localhost/SAMPLE-SERVER";          SampleServer remoteObject = (SampleServer)Naming.lookup(url);          System.out.println("Got remote object");          //narrow the object down to a specific one          //System.out.println("Location: " + System.getProperty("LOCATION"));          // make the invocation        }      catch (RemoteException exc)        {          System.out.println("Error in lookup: " + exc.toString());        }      catch (java.net.MalformedURLException exc)        {          System.out.println("Malformed URL: " + exc.toString());        }      catch (java.rmi.NotBoundException exc)        {          System.out.println("NotBound: " + exc.toString());        }   }}

⌨️ 快捷键说明

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