簡體   English   中英

使用app bundler將Mac轉換為Mac OSX App Bundle

[英]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>

謝謝!

好吧,所以,在玩了一下之后,這就是我所理解的......

螞蟻腳本應該基於以下骨架......

<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}

應用程序包,在這種情況下, ButtonDemo.app將在appBundle目錄中創建。 如果可以,瀏覽ButtonDemo.app/Contents/Java的內容並確保所有必需的Jar文件都在那里......

快樂捆綁!

基於更新的build.xml文件進行了更新

1- project標簽沒有指定default目標。 想想這就像你的“主類”或“主要”方法,沒有,螞蟻不知道你想要運行什么...

<project name="Rage Mage" basedir="." default="bundle-RageMage">

2- taskdefname很重要,您可以在任何腳本中使用它來識別當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- deletemkdiroutputdirectory的屬性bundleapp相關...

<delete dir="appBundle" failonerror="false"/>
<mkdir dir="appBundle"/>
<bundleapp outputdirectory="bundle"...

或者,將它們全部appBundlebundle ,你想要的每一個......

4-你的主類不太可能是ragemage.src.Window ,可能是Window

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM