HelloClient.java
上传用户:sjz5218888
上传日期:2022-07-05
资源大小:4153k
文件大小:1k
源码类别:

多媒体编程

开发平台:

Java

  1. import HelloApp.*;
  2. import org.omg.CosNaming.*;
  3. import org.omg.CORBA.*;
  4. import java.io.*;
  5. public class HelloClient
  6. {
  7. public static void main(String args[])
  8. {
  9. try
  10. {
  11. ORB orb = ORB.init(args,null);
  12. org.omg.CORBA.Object objRef=orb.resolve_initial_references("NameService");
  13. NamingContext ncRef=NamingContextHelper.narrow(objRef);
  14. NameComponent nc = new NameComponent("Hello","");
  15. NameComponent path[]={nc};
  16. Hello helloRef=HelloHelper.narrow(ncRef.resolve(path));
  17. //helloRef.menu();
  18. String alamat="\server\file";
  19. //String namafile="tes.mp3";
  20. java.io.DataInputStream dis = new java.io.DataInputStream(System.in);
  21. System.out.print("Masukan nama file: ");
  22. String namafile=dis.readLine();
  23. String serverPath="";
  24. serverPath=helloRef.getserver();
  25. helloRef.copy(serverPath,namafile);
  26. String p = "c:\program files\windows media player\mplayer2.exe "+alamat+"\"+namafile;
  27. Runtime.getRuntime().exec(p);
  28.        
  29. }
  30. catch (Exception e)
  31. {
  32. System.out.println("ERROR "+e);
  33. e.printStackTrace(System.out);
  34. }
  35.   }
  36. }