Home > Java > JavaBase > body text

How to open exe file in java

angryTom
Release: 2019-11-11 17:32:39
Original
3813 people have browsed it

How to open exe file in java

How to open exe in java

In java, RunTime.getRuntime().exec() implements the call Server command scripts are required to perform functions.

Usage: (Recommended tutorial: java tutorial)

public Process exec(String command)-----在单独的进程中执行指定的字符串命令。
public Process exec(String [] cmdArray)---在单独的进程中执行指定命令和变量
public Process exec(String command, String [] envp)----在指定环境的独立进程中执行指定命令和变量
public Process exec(String [] cmdArray, String [] envp)----在指定环境的独立进程中执行指定的命令和变量
public Process exec(String command,String[] envp,File dir)----在有指定环境和工作目录的独立进程中执行指定的字符串命令
public Process exec(String[] cmdarray,String[] envp,File dir)----在指定环境和工作目录的独立进程中执行指定的命令和变量
Copy after login

1. First, call the application that comes with the windows system

How to open exe file in java

Then put it in main as a test, run the java file, that is, open Notepad The application

How to open exe file in java

2. The second method directly uses the local full path to run. Take the application as shown in the figure as an example. This is its startup program. Directory path

How to open exe file in java and then use the line of code shown in the figure to execute. In fact, the difference from the first method is whether the full path of the file that needs to be started is required.

3. The last method is to use the String[] array to pass parameters to start the application

How to open exe file in javaIn this way, the specified file will be opened with notepad.

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

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template