从执行的Flex / AIR或Java Web应用程序的外部EXE [英] Execute an external EXE from Flex/AIR or Java Web Application
本文介绍了从执行的Flex / AIR或Java Web应用程序的外部EXE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
需要执行,无论是从Java的Web应用程序(在Windows服务器上运行的Glassfish的)外部的EXE或从的Flex / AIR的桌面应用程序。
Need to execute an external EXE from either a Java web app (running on Glassfish on Windows Server) or from an Flex/AIR desktop app.
任何建议,链接?
谢谢
推荐答案
好吧。我找到了答案...
Okay .. I found the answer ...
import java.io.*;
public class Main {
public static void main(String args[]) {
try {
Runtime rt = Runtime.getRuntime();
//Process pr = rt.exec("cmd /c dir");
Process pr = rt.exec("c:\\helloworld.exe");
BufferedReader input = new BufferedReader(new InputStreamReader(pr.getInputStream()));
String line=null;
while((line=input.readLine()) != null) {
System.out.println(line);
}
int exitVal = pr.waitFor();
System.out.println("Exited with error code "+exitVal);
} catch(Exception e) {
System.out.println(e.toString());
e.printStackTrace();
}
}
}
这篇关于从执行的Flex / AIR或Java Web应用程序的外部EXE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文