简体   繁体   English

Apple .app(使用Ant的JarBundler构建)将无法运行

[英]Apple .app (build with Ant's JarBundler) won't run

I build my app with the following build.xml When I click on release/MyApp.app, it won't run!!! 我使用以下build.xml构建应用程序。当我单击release / MyApp.app时,它将无法运行!

But when I do 但是当我这样做

java -jar release/MyApp.app/Contents/Resources/Java/helloworld.jar

the executable (a Windows) does come up, meaning the helloworld.jar is built correctly. 可执行文件(Windows)出现了,这意味着helloworld.jar已正确构建。 But for some reason, the app doesn't know to load it. 但是由于某种原因,该app不知道要加载它。

<?xml version="1.0" encoding="UTF-8"?>
<project name="App Builder" default="build_app" basedir=".">

  <taskdef name="jarbundler"
           classname="net.sourceforge.jarbundler.JarBundler" />

  <target name="build_app">
    <jarbundler dir="release"
            name="MyApp"
            mainclass="com.test" 
            jar="helloworld.jar" />
  </target>
</project>

Does anyone know what is wrong here? 有人知道这是怎么回事吗?

Thanks 谢谢

+1 to trashgod. +1成为垃圾神。 When testing this (from your previous question), my app wouldn't start. 当测试此问题(来自您先前的问题)时,我的应用程序无法启动。 It was because the Stub was using Java 6 instead of Java 7 ... go figure. 这是因为存根使用的是Java 6而不是Java 7。 Once I compiled my files down to Java 6, it worked fine. 一旦将文件编译为Java 6,它就可以正常工作。

Also, make sure that you are including all the dependent Jar files... 另外,请确保您包括所有相关的Jar文件...

I used this as my target... 我以此为目标...

<target name="default">
    <delete dir="package" failonerror="false"/>
    <mkdir dir="package"/>
    <jarbundler dir="package"
                name="Cars"
                mainclass="testanimation10.TestAnimation10">
        <jarfileset dir="dist">
            <include name="**/*.jar" />
            <!--<exclude name="**/CVS" />-->
        </jarfileset>
    </jarbundler>

Updated 更新

I downloaded Java Application Bundler from java.net, which seems to be the replacement for Apple's bundler and following the basic instructions from here and was able to build a bundle that was capable of running binaries compiled under Java 7 我从java.net下载了Java Application Bundler ,它似乎是Apple捆绑器的替代品,并且按照此处的基本说明进行操作,并且能够构建一个能够运行在Java 7下编译的二进制文件的捆绑软件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM