简体   繁体   中英

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

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. But for some reason, the app doesn't know to load it.

<?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. 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. Once I compiled my files down to Java 6, it worked fine.

Also, make sure that you are including all the dependent Jar files...

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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