将.jar转换为Mac OS X应用 [英] Converting a .jar into a Mac OS X app

查看:97
本文介绍了将.jar转换为Mac OS X应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为Mac和Windows创建基于Java的GUI.到目前为止,我已经能够创建在Windows上运行的可执行文件 .jar .

I'm trying to create a java-based GUI for both Mac and windows. So far, I've been able to create an executable .jar file that runs on Windows.

我遇到的问题是在Mac上运行 .jar .当我双击运行时,它说我应该使用 -XstartOnFirstThread 选项来运行 .jar .因此,我创建了一个shell脚本,只需使用以下代码行即可将其打开:

The issue I'm running into is running that .jar on Mac. When I double-click to run, it says I should use -XstartOnFirstThread option to run the .jar. So, I've created a shell script that simply opens it with the following line of code:

java -XstartOnFirstThread -jar myJar.jar

这可以很好地运行程序,但这不是一个易于分发的解决方案.因此,我正在尝试将.jar捆绑到Mac应用中.到目前为止,我尝试过的所有操作都导致相同的错误代码:

This runs the program well, but it's not a solution that is easily distributable. So, I'm trying to bundle the .jar into a Mac app. So far, everything I've tried results in the same error code:

LSOpenURLsWithRole() failed for the application MyApp.app with error -10810

这是到目前为止我尝试过的:

Here's what I've tried so far:

  • JarBundler(链接此处):相同问题

Java教程:尝试按照本教程进行操作,但是appbundler似乎不再存在(至少我无法在Mac上找到它,也无法在Java的网站上找到它),并且指向此页面上其他软件的大多数链接都已失效..

Java Tutorial: tried following this tutorial, but appbundler seems not to exist anymore (at least I can't find it on my mac and I can't find it on Java's website) and most of the links to other softwares that are on this page are dead.

AppBundler ant任务(链接此处):无法完全了解如何用这个.

AppBundler ant task (link here): Couldn't quite firgure out how to use this.

Eclipse OS-X App Bundler:相同的问题.

Eclipse OS-X App Bundler: same issue.

在应用程序内更改可执行JavaApplicationStub的权限:相同问题

changing permissions on the executable JavaApplicationStub within the app: same issue

我从头开始将应用程序捆绑在一起:相同的问题.

bundling the app on my own from scratch: same issue.

这时我几乎没有主意了,我有什么想念的吗?

I'm pretty much out of ideas at this point, is there anything I am missing?

我正在使用的.jar文件是由Eclipse的创建可运行的JAR文件"导出选项创建的.不知道这是否有所不同.

The .jar file that I'm using was created by Eclipse's "create runnable JAR file" export option. Not sure if this makes a different or not.

推荐答案

我刚刚使用此 步骤:

  1. 确保在您的Mac上安装了python,如果未使用 brew 并使用fire brew安装python3
  2. git clone https://github.com/Jorl17/jar2app
  3. cd jar2app
  4. sudo ./install.sh/usr/local
  5. /usr/local/jar2app〜/Downloads/Mario.jar//用您的jar替换jar路径
  6. 检查在当前目录下创建的新.app
  1. Make sure python is installed on your mac, if not use brew and fire brew install python3
  2. git clone https://github.com/Jorl17/jar2app
  3. cd jar2app
  4. sudo ./install.sh /usr/local
  5. /usr/local/jar2app ~/Downloads/Mario.jar // replace jar path with your jar
  6. check new .app is created in the current directoty

这篇关于将.jar转换为Mac OS X应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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