JimmyÀÇ È¨ÆäÀÌÁö > Java > JAVA Module & Tip 1.

       

Á¦¸ñ : JAVA Module & Tip 1.(C¿¡¼­ÀÇ system»ç¿ë)
import java.io.*;
import java.lang.*;
public class runtime {
   public static void main(String args[])
   {
      if (args.length  < 1) {
         System.err.println("usage: javac runtime command\n");
         System.exit(1);
      }

    
      StringBuffer command = new StringBuffer();
      for( int i = 0; i < args.length; i++ )
         command.append(args[i]+ " ");

      Process ps = null;
      OutputStream out = null;
      BufferedReader in = null;
      String res =null;

      try {
       ps = Runtime.getRuntime().exec(command.toString());
      }catch(IOException e) {
       System.out.println(e);
      }

       in = new BufferedReader(new InputStreamReader(
                  ps.getInputStream()));
       out = ps.getOutputStream();

      try {
       while((res = in.readLine()) != null)
        System.out.println(res);
      }catch(IOException e) {
       System.out.println(e);
      }
   }
}

-------------------------------------------------
°á°ú:
--------------------------------------------------
¼³¸í.
 Java¿¡¼­´Â RuntimeÀ» »ç¿ëÇÏ¿© CÀÇ systemÀÇ ±â´ÉÀ» Á¦°øÇÕ´Ï´Ù.
  


À§ÀÇ ¼Ò½º´Â javalandÀÇ ¼Ò½º¸¦ ÂüÁ¶Çß½À´Ï´Ù.
±Ã±ÝÇÑÁ¡ÀÖÀ¸¸é Q&A¿¡ ±ÛÀ»³²°ÜÁÖ¼¼¿ä

Jimmy´Â ´©±¸Àΰ¡bit10ÁÖ¼Ò·Ï - ¹æ¸í·Ï - Q&A - E-mail

½Åºñ·Î - °æÈñ´ëÀüÀÚ°ú88Çйø¸ðÀÓ¹æ - ¶óÀÌÄÚ½º - Æ®¶óÀÌÆ÷µå


Âü°í·Î Á¦È¨ÆäÀÌÁöÀÇ Çü½ÄÀº ¶óÀÌÄÚ½º ȨÆäÀÌÁöÀÇ ¼Ò½º¸¦ ÂüÁ¶ÇÏ¿´½À´Ï´Ù.