从Java执行.app资料夹? [英] Executing .app folder from Java?

查看:55
本文介绍了从Java执行.app资料夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一种合理的方法直接从Java执行.app目录,而不是深入挖掘以查找二进制文件?我有一个带有一些首选项的应用程序,其中包括用于打开各种内容的外部程序,如果在OSX上用户可以只选择.app文件夹,那就太好了.我可以寻找.app扩展名,并在需要时以不同的方式处理它.

Is there a reasonable way to execute a .app directory directly from Java instead of digging down to find the binary? I've got an app with some preferences that include external programs for opening various things, it'd be nice if on OSX the user could just select the .app folder. I could look for the .app extension and handle it differently if necessary.

推荐答案

您可以在终端中简单地调用"open appname.app".因此,... Runtime.getRuntime().exec("open path.app")应该可以正常工作.

You can simply call "open appname.app" in the Terminal. So ... Runtime.getRuntime().exec("open path.app") should work fine.

这篇关于从Java执行.app资料夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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