HelloClient.java
上传用户:sjz5218888
上传日期:2022-07-05
资源大小:4153k
文件大小:1k
- import HelloApp.*;
- import org.omg.CosNaming.*;
- import org.omg.CORBA.*;
- import java.io.*;
- public class HelloClient
- {
- public static void main(String args[])
- {
- try
- {
- ORB orb = ORB.init(args,null);
- org.omg.CORBA.Object objRef=orb.resolve_initial_references("NameService");
- NamingContext ncRef=NamingContextHelper.narrow(objRef);
- NameComponent nc = new NameComponent("Hello","");
- NameComponent path[]={nc};
- Hello helloRef=HelloHelper.narrow(ncRef.resolve(path));
- //helloRef.menu();
- String alamat="\server\file";
- //String namafile="tes.mp3";
- java.io.DataInputStream dis = new java.io.DataInputStream(System.in);
- System.out.print("Masukan nama file: ");
- String namafile=dis.readLine();
- String serverPath="";
- serverPath=helloRef.getserver();
- helloRef.copy(serverPath,namafile);
- String p = "c:\program files\windows media player\mplayer2.exe "+alamat+"\"+namafile;
- Runtime.getRuntime().exec(p);
-
-
- }
- catch (Exception e)
- {
- System.out.println("ERROR "+e);
- e.printStackTrace(System.out);
- }
- }
- }