使用应用程序捆绑器将Mac OSX App捆绑到jar [英] Jar to Mac OSX App Bundle with app bundler
问题描述
我正在尝试使用 app bundler
将我的.jar捆绑到MacOSX应用包中。
我正在学习本教程。
I'm trying to bundle my .jar to a MacOSX app bundle, using app bundler
.
I'm following this tutorial.
它说要在高级项目目录中添加一个 lib
文件夹,但我不知道知道这意味着什么。我一直在寻找它,我无法找到它是什么。这是我唯一的问题,有人知道吗?
It says to add a lib
folder to the high-level project directory, but I don't know what that means. I've been looking everywhere for it, and I cannot find out what it is. That's my only problem I have, anyone know?
编辑:
这是我的 build.xml
file:
<project name="Rage Mage" basedir=".">
<taskdef name="ragemage"
classname="com.oracle.appbundler.AppBundlerTask"
classpath="lib/appbundler-1.0.jar" />
<target name="bundle-RageMage">
<delete dir="appBundle" failonerror="false"/>
<mkdir dir="appBundle"/>
<bundleapp outputdirectory="bundle"
name="Rage Mage"
displayname="Rage Mage"
icon="res/icon.icns"
identifier="ragemage.src.Window"
mainclassname="ragemage.src.Window">
<classpath file="dist/ragemage_1.1.1.jar" />
</bundleapp>
</target>
谢谢!
推荐答案
好的,所以,经过一番游戏,这就是我所理解的......
Okay, so, after having a little play around, this is what I understand...
- 下载 Java Application Bundler 并将其放入
lib
项目目录。您将需要创建此目录... - 在您的项目目录中创建一个新的Ant脚本,随时调用它...另外,花点时间阅读< a href =https://java.net/downloads/appbundler/appbundler.html\"rel =nofollow>
AppBundler
任务文档
- Download Java Application Bundler and place it in the
lib
directory of your project. You will need to create this directory... - Create a new Ant script into your project directory, call it what ever you like...Also, take the time to read through the
AppBundler
Task Docs
蚂蚁脚本应该基于以下骨架......
The ant script should be based on the following skeleton...
<project name="ButtonDemo" default="bundle-buttonDemo" basedir=".">
<taskdef name="bundleapp"
classname="com.oracle.appbundler.AppBundlerTask"
classpath="lib/appbundler-1.0.jar" />
<!-- See the lib reference here, this is why you need to use the lib directory! -->
<target name="bundle-buttonDemo">
<delete dir="appBundle" failonerror="false"/>
<mkdir dir="appBundle"/>
<bundleapp outputdirectory="appBundle"
name="ButtonDemo"
displayname="Button Demo"
identifier="components.ButtonDemo"
mainclassname="components.ButtonDemo">
<!-- The following is important and should point to your build -->
<classpath file="dist/ButtonDemo.jar" />
<!-- You can have multiple instance of classpath if you 3rd party or
dependent jars in different locations -->
</bundleapp>
</target>
</project>
- 建立项目
- 运行ant脚本,使用(例如)
ant -f {You App Bundler script}
- Build your project
- Run the ant script, using (something like)
ant -f {You App Bundler script}
应用程序包,在这种情况下 ButtonDemo.app
将在 appBundle
目录中创建。如果可以,浏览<$ c $ c> ButtonDemo.app/Contents/Java 的内容,并确保所有必需的Jar文件都在那里......
The app bundle, in this case ButtonDemo.app
will be created in appBundle
directory. If you can, browse the contents of the ButtonDemo.app/Contents/Java
and make sure all your required Jar files are there...
快乐捆绑!
根据更新的build.xml文件更新
1- 项目
标记指定的默认
目标没有。想想这就像你的主类或主要方法,没有,蚂蚁不知道你想要运行什么......
1- There is no default
target specified by the project
tag. Think of this like your "main class" or "main" method, without, ant has no idea what you want to run...
<project name="Rage Mage" basedir="." default="bundle-RageMage">
2- 名称
的 taskdef
非常重要,您可以在任何脚本中使用它来识别当ant到达您的标记引用时应该做什么...
2- The name
of the taskdef
is significant and you use it in the any script to identify what ant should do when it hits your tag reference...
因此,根据您的示例,您需要将 taskdef
的名称从 ragemage
更改为 bundleapp
或将 bundleapp
标记更改为 ragemage
...
So based on your example, you either need to change the name of the taskdef
from ragemage
to bundleapp
or change the bundleapp
tag to ragemage
...
要么改变这个......
Either change this...
<taskdef name="bundleapp"
classname="com.oracle.appbundler.AppBundlerTask"
classpath="lib/appbundler-1.0.jar" />
或者这个(在目标 bundle-RageMage
)
<ragemage outputdirectory="bundle"
name="Rage Mage"
displayname="Rage Mage"
icon="res/icon.icns"
identifier="ragemage.src.Window"
mainclassname="ragemage.src.Window">
<classpath file="dist/ragemage_1.1.1.jar" />
</ragemage>
就个人而言,我将其保留为 bundleapp
,但那就是我......
Personally, I'd leave it as bundleapp
, but that's me...
3- 删除
, mkdir
和 outputdirectory
属性 bundleapp
是相关的......
3- The delete
, mkdir
and outputdirectory
attribute of bundleapp
are related...
<delete dir="appBundle" failonerror="false"/>
<mkdir dir="appBundle"/>
<bundleapp outputdirectory="bundle"...
要么全部让它们全部 appBundle
或捆绑
,你想要的......
Either, make them all appBundle
or bundle
, what every you want...
4-您的主类不太可能 ragemage.src.Window
并且可能是 Window
4- You main class is unlikely to be ragemage.src.Window
and is probably going to be Window
这篇关于使用应用程序捆绑器将Mac OSX App捆绑到jar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!