![](/img/trans.png)
[英]OSX Java App Bundle works on one Mac, but not on another.
[英]Jar to Mac OSX App Bundle with app bundler
我正在嘗試使用app bundler
將我的.jar捆綁到MacOSX應用包中。 我正在學習本教程。
它說要將lib
文件夾添加到高級項目目錄中,但我不知道這意味着什么。 我一直在尋找它,我無法找到它是什么。 這是我唯一的問題,有人知道嗎?
編輯:
這是我的build.xml
文件:
<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>
謝謝!
好吧,所以,在玩了一下之后,這就是我所理解的......
lib
目錄中。 您需要創建此目錄... AppBundler
調用它...另外,花點時間閱讀AppBundler
任務文檔 螞蟻腳本應該基於以下骨架......
<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 -f {You App Bundler script}
應用程序包,在這種情況下, ButtonDemo.app
將在appBundle
目錄中創建。 如果可以,瀏覽ButtonDemo.app/Contents/Java
的內容並確保所有必需的Jar文件都在那里......
快樂捆綁!
基於更新的build.xml文件進行了更新
1- project
標簽沒有指定default
目標。 想想這就像你的“主類”或“主要”方法,沒有,螞蟻不知道你想要運行什么...
<project name="Rage Mage" basedir="." default="bundle-RageMage">
2- taskdef
的name
很重要,您可以在任何腳本中使用它來識別當ant到達您的標記引用時應該做什么...
因此,根據您的示例,您需要將taskdef
的名稱從ragemage
更改為bundleapp
或將bundleapp
標記更改為ragemage
...
要么改變這個......
<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
,但那就是我......
3- delete
, mkdir
和outputdirectory
的屬性bundleapp
相關...
<delete dir="appBundle" failonerror="false"/>
<mkdir dir="appBundle"/>
<bundleapp outputdirectory="bundle"...
或者,將它們全部appBundle
或bundle
,你想要的每一個......
4-你的主類不太可能是ragemage.src.Window
,可能是Window
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.