首先找到其中的exe文件被创建located.Then命名为
“Your_Exe_File_Name名为” .exe.manifest
只要把下面的内容保存到一个文本文件的目录该文件并保存。
processorArchitecture="X86"
name="MyApp.exe"
type="win32"/>
elevate execution level
现在在您的java代码中使用它来调用exe.It将被自动调用Admin Rights。
Process process = new ProcessBuilder("C:\\PathToExe\\MyExe.exe","param1","param2",).start();
InputStream is = process.getInputStream();//Get an inputstream from the process which is being executed
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line;
while ((line = br.readLine()) != null) {
System.out.println(line);//Prints all the outputs.Which is coming from the executed Process
}
我认为这会对您有所帮助。