我要开始的Java环境的背景下.NET应用程序(带单声道兼容)。
I want to start a .NET application (compatible with Mono) from the context of a Java environment.
我的猜测是,我必须以某种方式找出如果安装了单,找到位置并启动使用.NET应用程序路径作为参数。
My guess would be that I'd have to somehow figure out if mono is installed, find the location and start that using the .NET application path as a parameter.
但是,什么是一个强大的方式做到这一点?还是有更好的办法吗?
But what is a robust way to do it? Or is there a better way?
也许我要澄清的背景:在Java部分运行在具有有限的交互环境可能一个插件,所以我真的preFER找到一种方法,而不必需要一个配置文件或用户界面
Perhaps I should clarify the context: the Java part is running as a plugin in an environment with limited interaction possible, so I would really prefer to find a way without having to need a configuration file or an user-interface.
推荐答案
如果您已经.NET /单已经安装,您可以双击exe文件,它运行,那么你可以只使用 Desktop.open()
一样简单:
Desktop.getDesktop().open(file);
在这里看到更多的细节:在Java SE使用桌面API 6 修改
我不得不启动我的Linux机器在那里我有一个单一的应用程序,这工作好了:
I had to boot my Linux box where I have a mono application and this worked just great:
class Launch {
public static void main( String ... arg ) {
new ProcessBuilder("/usr/bin/myapp").start();
}
}
重复,工作好了!
Repeat, worked just great!
相关推荐
最新文章