KickJava   Java API By Example, From Geeks To Geeks.

Java > Java SE, EE, ME > java > lang > Process

java.lang
Class Process

java.lang.Object
  extended by java.lang.Process
See Also:
Top Examples, Source Code, getErrorStream(), getInputStream(), getOutputStream(), ProcessBuilder.start(), Runtime.exec(String[], String[] File)

public abstract void destroy()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public abstract int exitValue()
See Also:
IllegalThreadStateException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public abstract InputStream getErrorStream()
See Also:
ProcessBuilder.redirectErrorStream()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[932]Pass data between proess
By Anonymous on 2004/09/27 11:14:31  Rate
getOutputStream is the "executing process' 'into standard in' connector" 
 getInputStream is the "executing process' 'out of standard out' connector" 
 getErrorStream is the "executing process' 'out bound' error messages connector" 
  
  
 Process.getOutputStream lets you write out data that will be used as input to the process. Don't forget to include any "\n" and "\r" characters the process is expecting. Process.getInputStream lets you read in the data that your process squirted out to stdout. 
 


[1126]_
By Anonymous on 2004/11/19 09:11:40  Rate
//Capturing out and err output 
  
  
 public class TestInOutErr 
  {  
   public static void main ( String [  ]  args )  throws IOException 
    {  
     Process p = Runtime.getRuntime (  ) .exec ( "java test" ) ; 
     BufferedReader in =  
               new BufferedReader (  
                     new InputStreamReader ( p.getInputStream (  )  )  ) ; 
     String currentLine = null; 
     while  (  ( currentLine = in.readLine (  )  )  != null )  
       System.out.println ( currentLine ) ; 
     BufferedReader err = 
               new BufferedReader (  
                     new InputStreamReader ( p.getErrorStream (  )  )  ) ; 
     while  (  ( currentLine = err.readLine (  )  )  != null )  
       System.out.println ( currentLine ) ; 
    }  
  }  
 


public abstract InputStream getInputStream()
See Also:
ProcessBuilder.redirectErrorStream()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[554]Execute Ping and display its results
By madhu on 2005/03/29 03:28:57  Rate
import java.lang.*; 
 public class  kj throws Exception 
  {  
 TextArea text; 
 Runtime r=Runtime.getRuntime (  ) ; 
 Process P=r.exec ( "ping 10.188.128.10" ) ; 
 text.setText ( P.getInputStream (  )  ) ; 
  }  
 


public abstract OutputStream getOutputStream()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public Process()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[1807]Execute a Windows system command
By Anonymous on 2006/08/23 12:19:12  Rate
import java.io.*; 
 public class CmdExec  {  
  
  
 public static void main ( String argv [  ]  )   {  
     try  {  
      String line; 
      Process p = Runtime.getRuntime (  ) .exec 
          ( System.getenv ( "windir" )  +"\\system32\\"+"tree.com /A" ) ; 
      BufferedReader input = 
        new BufferedReader 
           ( new InputStreamReader ( p.getInputStream (  )  )  ) ; 
      while  (  ( line = input.readLine (  )  )  != null )   {  
        System.out.println ( line ) ; 
         }  
      input.close (  ) ; 
       }  
     catch  ( Exception err )   {  
      err.printStackTrace (  ) ; 
       }  
    }  
  } 


public abstract int waitFor()
                     throws InterruptedException
See Also:
interrupted
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  

Popular Tags