Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Using of one-jar in windows and Mac

Anonymous
2012-11-03
2013-05-23

  • Anonymous
    2012-11-03

    Hi

    I think one-jar is an excellent tool for creating jar files. However I am currently encountering a problem when executing it using Windows.

    In Windows when i execute the jar, I would get

      java.lang.NoClassDefFoundError: com/simontuffs/onejar/Boot
          Caused by: java.lang.ClassNotFoundException: com.simontuffs.onejar.Boot
          at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
          at java.security.AccessController.doPrivileged(Native Method)
          at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
          at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
          Could not find the main class: com.simontuffs.onejar.Boot. Program will exit.
          Exception in thread "main"
          Java Result: 1

    In Mac, the application would run normally,
    The ant build code that I have is

         <target name="onejar" depends="jarFile">  
            <taskdef name="one-jar"
                         classname="com.simontuffs.onejar.ant.OneJarTask"
                         classpath="${external.jar}/onejar.jar" />
          <!-- Construct the One-JAR file -->     
    <one-jar destfile="${build.dir}/jar/FinalMinitron.jar">  
                 <main jar="${build.dir}/jar/Minitron.jar">  
                 </main>  
            <manifest>
                <attribute name="Main-Class" value="lib.host.MiniGUI"/>   
                <attribute name="Class-Path" value="${nxj.home}/lib/nxt/classes.jar;${nxj.home}/lib/pc/pccomm.jar"/>
            </manifest>
                 <lib>  
                    <fileset dir="${target.classes.java.dir}">
                        <include name="**/*.class"/>
                    </fileset>
                     <fileset dir="${external.jar}" />
                    <fileset dir="${lejosPC}">
                        <include name="**/*.jar"/>
                    </fileset>
                    <fileset dir="${lejosNXT}">
                    <include name="**/*.jar"/>
                    </fileset>
                 </lib>  
          </one-jar>
    

    Can anyone out there offer me some advice on where did i go wrong for this in Windows? I uses the same script in Mac and I don't have a single problem on this.