Hulihrach

Untitled

Jul 11th, 2014
344
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.89 KB | None | 0 0
  1. import java.io.*;
  2.  
  3. public class Main {
  4.  
  5.     public static void main(String[] args) {
  6.         long totalMemory = run.totalMemory();
  7.         String[] getServersCommand = {"ls","","servery/*/"," | grep .jar"};
  8.         Runtime run = Runtime.getRuntime();
  9.         Process pr = null;
  10.         try {
  11.             pr = run.exec(getServersCommand);
  12.         } catch (IOException e) {
  13.             e.printStackTrace();
  14.         }
  15.         try {
  16.             pr.waitFor();
  17.         } catch (InterruptedException e) {
  18.             e.printStackTrace();
  19.         }
  20.         BufferedReader buf = new BufferedReader(new InputStreamReader(pr.getInputStream()));
  21.         String line;
  22.         try {
  23.             while ( ( line = buf.readLine() ) != null )
  24.             {
  25.                 System.out.println(line);
  26.             }
  27.         } catch (IOException e) {
  28.             e.printStackTrace();
  29.         }
  30.     }
  31. }
Advertisement
Comments
  • User was banned
Add Comment
Please, Sign In to add comment