如何执行从C#Java程序? [英] How to execute a Java program from C#?

查看:126
本文介绍了如何执行从C#Java程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果有人知道一个很好的方式在运行时从C#code执行Java命令行程序想知道?

Wondering if anyone knows a nice way to execute a Java command-line program from C# code at run-time ?

这是不是等同于执行本地.exe文件?

Is it the same as executing native .EXE files ?

它会同步或异步运行(这意味着我可能要等待线程完成找出来的结果)

Will it run synchronously or asynchronously (which means I may have to wait for the thread to finish to find out the results)

具体来说,我想打电话给从服务器端Web的应用程序的小工具(这恰好用Java编写)做一个文本文件中的一些处理。我想等它完成了Java程序完成处理文本文件,我想抓住的处理文本,因为后,和C#应用程序中使用它。

Specifically I would like to call a little utility (which happens to be written in Java) from a web-application on the server side to do some processing on a text file. I want to wait for it to finish because after the Java program is done processing the text file I want to grab the processed text, and use it within the C# application.

推荐答案

如果你需要更精确的控制不是启动外部程序,然后再考虑IKVM - HTTP ://www.ikvm.net/ - 它提供了一种方法来运行.NET世界里面的Java程序

If you need finer control than launching an external program, then consider IKVM - http://www.ikvm.net/ - which provides a way to run Java programs inside a .NET world.

这篇关于如何执行从C#Java程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆