首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Jar到Mac应用包与应用程序绑定

Jar到Mac应用包与应用程序绑定
EN

Stack Overflow用户
提问于 2014-07-27 05:31:42
回答 1查看 6.6K关注 0票数 3

我正在尝试使用.jar将我的MacOSX应用包捆绑到一个MacOSX应用包中。我正在学习本教程。

它说要向高级项目目录中添加一个lib文件夹,但我不知道这意味着什么。我一直在到处找它,但我找不到它是什么。这是我唯一的问题,有人知道吗?

编辑:

这是我的build.xml文件:

代码语言:javascript
复制
<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>

谢谢!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-07-28 10:02:05

好吧,在玩了一会儿之后,这就是我理解的.

  • 下载Java应用程序绑定器并将其放在项目的lib目录中。你需要创建这个目录..。
  • 在项目目录中创建一个新的Ant脚本,管它叫like...Also,花时间阅读任务文档

蚂蚁脚本应该基于以下骨架..。

代码语言:javascript
复制
<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-没有由default标记指定的project目标。就像你的“主类”或“主”方法,没有,蚂蚁不知道你想运行什么.

代码语言:javascript
复制
<project name="Rage Mage" basedir="." default="bundle-RageMage">

2- name of taskdef非常重要,您可以在任意脚本中使用它来确定ant在访问标记引用时应该做什么.

因此,根据您的示例,您需要将taskdef的名称从ragemage更改为bundleapp,或者将bundleapp标记更改为ragemage.

要么改变这个..。

代码语言:javascript
复制
<taskdef name="bundleapp"
     classname="com.oracle.appbundler.AppBundlerTask"   
     classpath="lib/appbundler-1.0.jar" />

(在目标bundle-RageMage中)

代码语言:javascript
复制
<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有一定的相关性。

代码语言:javascript
复制
<delete dir="appBundle" failonerror="false"/>
<mkdir dir="appBundle"/>
<bundleapp outputdirectory="bundle"...

或者,让他们都是appBundlebundle,你想要什么.

4-您的主要类不太可能是ragemage.src.Window,而且很可能是Window

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/24978212

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档