Home  >  Article  >  Java  >  How to use Process in java

How to use Process in java

王林
王林forward
2023-05-10 11:04:051147browse

Explanation

1. The Process class is an abstract class (all methods are abstract), encapsulating the process (i.e. executing the program).

2. The Process class provides methods for inputting from the process, executing output to the process, waiting for the process to complete, checking the exit status of the process, and destroying the process.

Example

Process p = null;  
try {  
    p = Runtime.getRuntime().exec("notepad.exe");  
    p.waitFor();  
} catch (Exception e) {  
    e.printStackTrace();  
}  
System.out.println("我想被打印...");

What Java can be used for

Java is mainly used in: 1. web development; 2. Android development; 3. client Development; 4. Web development; 5. Enterprise-level application development; 6. Java big data development; 7. Game development, etc.

The above is the detailed content of How to use Process in java. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete