我如何开始从Java在Linux,Mac和Windows .NET应用程序? [英] How can I start a .NET application from Java on Linux, Mac and Windows?

查看:160
本文介绍了我如何开始从Java在Linux,Mac和Windows .NET应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要开始的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文件,它运行,那么你可以只使用<一HREF =htt​​p://download.oracle.com/javase/6/docs/api/java/awt/Desktop.html#open%28java.io.File%29相对=nofollow> 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!

这篇关于我如何开始从Java在Linux,Mac和Windows .NET应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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