0

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

user1508893
  • 9,223
  • 14
  • 45
  • 57
  • 1
    When you use JarBundler the `.app` package requires a Java application stub. Did you add that? http://informagen.com/JarBundler/StubFile.html – Ankit Feb 17 '13 at 04:41
  • 1
    See also this [answer](http://stackoverflow.com/a/2929159/230513). – trashgod Feb 17 '13 at 05:09

1 Answers1

0

+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

MadProgrammer
  • 343,457
  • 22
  • 230
  • 366