Topic: 如何使用Java去调用一个windows上的应用程序? |
Print this page |
1.如何使用Java去调用一个windows上的应用程序? | Copy to clipboard |
Posted by: cl8181 Posted on: 2006-09-18 11:33 如何调用一个windows上的应用程序呢? 谢谢 |
2.Re:如何使用Java去调用一个windows上的应用程序? [Re: cl8181] | Copy to clipboard |
Posted by: jackchengen Posted on: 2006-09-18 19:34 可以用Runtime,使用的例子如下: /////////////////////////////////// Runtime runtime=Runtime.getRuntime(); Process process = Runtime.getRuntime().exec("cmd /c mysql.exe <p2hp-initiate_database.sql -uroot -pchengen"); BufferedReader bufferedReader = new BufferedReader( new InputStreamReader(process.getInputStream())); String ls_1; while ( (ls_1=bufferedReader.readLine()) != null) System.out.println(ls_1); /////////////////////////////////// 上面的程序调用mysql程序将sql文件导入到数据库服务器中~ |
3.Re:如何使用Java去调用一个windows上的应用程序? [Re: cl8181] | Copy to clipboard |
Posted by: JiafanZhou Posted on: 2006-09-21 07:06 You might also think about JNI(Java Native Interface) which I have recently posted a thread in the following link: http://www.cjsdn.net/post/view?bid=1&id=182206&sty=1&tpg=1&age=0 Hope this will help. Regards, Jiafan |
4.Re:如何使用Java去调用一个windows上的应用程序? [Re: HenryShanley] | Copy to clipboard |
Posted by: ratking Posted on: 2006-09-21 11:33 除了上面两位提到的方法,使用IBM的bridge2java包来让Java调用ActiveX的OCX控件是另一种选择。 下面两个网址可能对你有用: 《弥补和 COM 的缝隙——发现 Bridge2Java 如何帮助扩展 Java 代码的范围》 http://www-128.ibm.com/developerworks/cn/java/j-bridge/index.html 《Interface Tool for Java——A tool that allows Java programs to communicate with ActiveX objects.》 http://www.alphaworks.ibm.com/tech/bridge2java |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |