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

Close

errors using command line one jar

James
2011-11-05
2013-05-23
  • James
    James
    2011-11-05

    http://one-jar.sourceforge.net/index.php?page=getting-started&file=quickstart

    Hello simontuffs
    I followed the startup command line instructions

    I am not sure if I added the root dir to the one jar or the MANIFEST.MF is wrong.

    When I create the jar I double click the jar and get the following error

    [code]
    Could not fin the main class com.simontuffs.onejar.Boot.Program will exit
    [/code]
    

    Followed instructions below:

    The use of Ant is not required: a One-JAR archive is simple to build using just the jar tool using the following steps.
    1. Create a working directory to act as the "root" of the one-jar with main, lib sub-directories.

    C:\Users\Steves\Documents\ceyesumma\java_cache\my_projects\netbeans\musicSystems\target_musicSystems\BundlingTools
    Added dir:
    \main
    \lib
    

    2. Copy your main application jar file into root/main and library dependencies into root/lib

    C:\Users\Steves\Documents\ceyesumma\java_cache\my_projects\netbeans\musicSystems\target_musicSystems\BundlingTools\main\musicSystems.jar
    
    C:\Users\Steves\Documents\ceyesumma\java_cache\my_projects\netbeans\musicSystems\target_musicSystems\BundlingTools\lib
    Contains:
    lib\AbsoluteLayout.jar
    lib\appframework-1.0.3.jar
    lib\jcalendar.jar
    lib\jdom-1.0.jar
    lib\joda-time-1.6.2.jar
    lib\joda-time-1.6.2-javadoc.jar
    lib\joda-time-1.6.2-sources.jar
    lib\joda-time-1.6.jar
    lib\junit-3.8.2.jar
    lib\junit-4.5-src.jar
    lib\swing-worker-1.1.jar
    lib\keycards.xml
    lib\keycardsDTD.DTD
    lib\ModelResourcesXML.properties
    

    3. Unjar the one-jar-boot-0.97.jar file into the root directory, and delete the "src" tree
    Extracted one-jar-boot-0.97.jar contents to  \BundlingTools and deleted the src dir

    C:\Users\Steves\Documents\ceyesumma\java_cache\my_projects\netbeans\musicSystems\target_musicSystems\BundlingTools
    

    4. Edit the boot-manifest.mf file and add a new line: One-Jar-Main-Class: your-main-class

    Starting contents of MANIFEST.MF
    Manifest-Version: 1.0
    Ant-Version: Apache Ant 1.7.1
    Created-By: One-Jar 0.97 Ant taskdef
    One-Jar-Main-Class: com.simontuffs.onejar.sdk.Install
    One-Jar-Expand:
    One-Jar-Expand-Dir: ./one-jar-sdk-0.97
    One-Jar-Confirm-Expand: true
    One-Jar-Show-Expand: true
    Main-Class: com.simontuffs.onejar.Boot

    edited MANIFEST.MF

    Manifest-Version: 1.0
    Ant-Version: Apache Ant 1.7.1
    Created-By: One-Jar 0.97 Ant taskdef
    One-Jar-Main-Class: com.simontuffs.onejar.sdk.Install
    One-Jar-Expand: 
    One-Jar-Expand-Dir: ./one-jar-sdk-0.97
    One-Jar-Confirm-Expand: true
    One-Jar-Show-Expand: true
    Main-Class: com.simontuffs.onejar.Boot
    One-Jar-Main-Class: C:\Users\Steves\Documents\ceyesumma\java_cache\my_projects\netbeans\musicSystems\target_musicSystems\musicSystems\src\view\main\Main
    

    5. cd root; jar -cvfm ../one-jar.jar boot-manifest.mf .
    following these instructions produces
    'jar' is not recognized as an internal or external command,
    operable program or batch file.

    C:\Users\Steves\Documents\ceyesumma\java_cache\my_projects\netbeans\musicSystems
    \target_musicSystems\BundlingTools>jar -cvfm C:\Users\Steves\Documents\ceyesumma
    \java_cache\my_projects\netbeans\musicSystems\target_musicSystems\musicSystemsOn
    eJar.jar  *.class C:\Users\Steves\Documents\ceyesumma\java_cache\my_projects\netb
    eans\musicSystems\target_musicSystems\BundlingTools\META-INF\MANIFEST.MF
    
    C:\Program Files\Java\jdk1.6.0_25\bin>jar -cvfm 
    C:\Users\Steves\Documents\ceyesumma\java_cache\my_projects\netbeans\musicSystems\target_musicSystems\musicSystemsOneJar.jar 
    C:\Users\Steves\Documents\ceyesumma\java_cache\my_projects\netbeans\musicSystems\target_musicSystems\BundlingTools\META-INF\MANIFEST.MF
    

    result

    added manifest
    

    double click new jar file:
    Java Virtual Machine Launcher

    Could not fin the main class com.simontuffs.onejar.Boot.Program will exit
    

    You should end up with a One-JAR archive which mirrors the "root" tree:
    one-jar.jar
    |  META-INF/MANIFEST.MF
    |  .version
    |  com/simontuffs/onejar
       |  Boot.class, …etc.
    |  doc/one-jar-license.txt
    |  main/main.jar
    |  lib/a.jar …etc.
    Thats it: no code to write, just a directory tree, some copy operations, and a file edit. The One-JAR classloader discovers the libraries and main code based on their position in the archive, and ignores any other Jar files should you need to embed archives which should not be on the classpath. Embedding the one-jar-license.txt ensures compliance with the BSD-style license.

     
  • P. Simon Tuffs
    P. Simon Tuffs
    2011-11-09

    I see a couple of things.  First, your One-Jar-Main-Class needs to be a fully qualified Java class name (including package) in 'dot' notation. So:

    One-Jar-Main-Class: C:\Users\Steves\Documents\ceyesumma\java_cache\my_projects\netbeans\musicSystems\target_musicSystems\musicSystems\src\view\main\Main

    should be something like:

    One-Jar-Main-Class: main.Main

    If your Main class is in package main.

    Second, you have another definition for One-Jar-Main-Class, make sure there is only the one shown above.

    Finally, inability to find com.simontuffs.onejar.Boot implies that you don't have this class at the *top level* of your one-jar file.  Please check your directory tree and make sure that this (and the other classes from one-jar-boot-0.97.jar) are at the top-level of your one-jar.

    Again, I encourage you to try the one-jar-appgen first, it does not create a Netbeans compatible project as you noted, but it will give you a working ant-buildable one-jar.  It can be used to rebuild itself after installation, to verify that everything is good.

    Once you get a working one-jar, integration with netbeans will be possible through the build.xml.

    $ java -jar one-jar-appgen-0.97.jar

    Enter project path (project name is last segment): c:/tmp/test-one-jar
    Enter java package name: com.example.onejar
    $ cd c:/tmp/test-one-jar
    $ ant
    $ cd build
    $ java -jar test-one-jar.jar
    test_one_jar main entry point, args=
    test_one_jar main is running
    test_one_jar OK.

     
  • P. Simon Tuffs
    P. Simon Tuffs
    2011-11-09

    One more step: please dump the results of jar -tvf your-one-jar.jar to this forum: will help to diagnose.

     
  • James
    James
    2011-11-09

    I did not add the -tvf because this consumed my time. I will try it in a minute.

    I apologize.  Every 3 months of java coding  try different versions of one jar and It is a good change of gears and I learn more about onejar and xml and command line but I am not strong at all with jars and manifest.

    here is the latest try.
    thanks for your time.

    This Code actually points to the Main.java I now
    Think it should point to the class file.  Main.class . is this correct

    Sp I changed :

    C:\Users\Steves\Documents\ceyesumma\java_cache\my_projects\netbeans\musicSystems
    \target_musicSystems\musicSystems\src\view\main\Main
    

    to point to the Main.class instead of main.java

    musicSystems.build.classes.view.main.Main
    

    because that is the package my project is in
    and  I removed the extra
    One-Jar-Main-Class: com.simontuffs.onejar.sdk.Install

    resulting in: MANIFEST.MF

    Manifest-Version: 1.0
    Ant-Version: Apache Ant 1.7.1
    Created-By: One-Jar 0.97 Ant taskdef
    One-Jar-Expand: 
    One-Jar-Expand-Dir: ./one-jar-sdk-0.97
    One-Jar-Confirm-Expand: true
    One-Jar-Show-Expand: true
    Main-Class: com.simontuffs.onejar.Boot
    One-Jar-Main-Class: musicSystems.build.classes.view.main.Main
    [code]
    My root folder contains the dir com (your dir containing the class .Boot
    Command line results:
    [code]
    C:\Program Files\Java\jdk1.6.0_25\bin>jar -cvfm C:\Users\Steves\Documents\ceyesu
    mma\java_cache\my_projects\netbeans\musicSystems\target_musicSystems\musicSystem
    sOneJar.jar C:\Users\Steves\Documents\ceyesumma\java_cache\my_projects\netbeans\
    musicSystems\target_musicSystems\BundlingTools\META-INF\MANIFEST.MF
    added manifest
    C:\Program Files\Java\jdk1.6.0_25\bin>
    [/code]
    Double click new musicSystemsOneJar.jar:
     [code]
    Could not find the main class com.simontuffs.onejar.Boot.Program will exit
    [/code]
    When I unpacked the contents of  one-jar-appgen-097 I followed the directions.
    
     
  • James
    James
    2011-11-09

    I am not sure what this means:

    C:\Program Files\Java\jdk1.6.0_25\bin>jar -tvf C:\Users\Steves\Documents\ceyesum
    ma\java_cache\my_projects\netbeans\musicSystems\target_musicSystems\musicSystems
    OneJar.jar
         0 Wed Nov 09 16:45:46 CST 2011 META-INF/
       313 Wed Nov 09 16:45:46 CST 2011 META-INF/MANIFEST.MF
    C:\Program Files\Java\jdk1.6.0_25\bin>
    
     
  • P. Simon Tuffs
    P. Simon Tuffs
    2011-11-12

    It means that your one-jar file was not created correctly.  I advise you to try the Ant based approach (one-jar-appgen-0.97.jar) to avoid the complexity of building your own jar archive.  You will need to install ant, you probably have it if you have Netbeans.

    I'm not sure how your jar file came to contain only the manifest, it should contain all the contents of the one-jar-boot-0.97.jar file, along with all your lib and main jars.

     
  • James
    James
    2011-11-12

    It seems that I followed the command line approach directions exactly as listed. Are the directions complete or did I
    miss understand them?

    Is the ant based approach refering to Ant Taskdef or the Application Generator Approach?
    The http://one-jar.sourceforge.net/index.php?page=getting-started&file=ant? or are you refering to the I am unfarmiliar with a lot of XML but that looks kind of easy.

    I just un zip the ""and add that XML to my project build.xml?

    If I try this does the "…etc"part refer to just add the closing tags?
    Ant Taskdef
    This path downloads the minimal environment needed to work with One-JAR using Ant. An advantage to this path is that the source-code for the Ant <one-jar> taskdef is provided for education purposes.
    Download one-jar-ant-task-0.97.jar
    Unpack into a working directory (e.g. c:/one-jar-ant):

    $ mkdir c:/one-jar-ant
    $ cd c:/one-jar-ant
    $ jar -xvf …/one-jar-ant-task-0.97.jar
    Add the following to your build.xml script:

    <property name="one-jar.dist.dir" value="c:/one-jar-ant"/>
    <import file="${one-jar.dist.dir}/one-jar-ant-task.xml" optional="true" />
    <one-jar destfile="your.one.jar"
    …etc.

     
  • P. Simon Tuffs
    P. Simon Tuffs
    2011-11-13

    I strongly recommend you follow the one-jar-appgen approach, since the ant-task method is, if anything, more complex than using the jar command.  The goal here is to get you into a working state, where you can build a one-jar (the appgen gets you this) using ant, and then you can modify that project/filesystem to build it with your own classes.

    Small steps like this are more likely to work than the big steps using jar and the ant taskdef.

    Good lucl.

     
  • James
    James
    2011-11-13

    Thanks , sounds like a plan. next time I try it I will try that one-jar-appgen approach again.  I liked that one I just could not adapt it to mine.
    I'll give it a shot. thanks agian.

     
  • James
    James
    2011-11-13

    One-JAR Appgen
    Ok I stand corrected.  It is the one-jar appgen approach not the eclipse generator program you are recommending. That is one I have not tried.  I have no idea what junit is.  Is that going to be compatible with a netbeans project? I have a lot to learn before I can use this.  I was hoping the Command Line approach was in working order so I did not have to start from scratch and learn a new Technology.

    I am in the middle of a pretty big project re-write for now. I will have to allocate time to
    Learn this approach.  It seems complicated.  That Command line approach almost works but something must be missing because it did not build the project.
    Do you for see anytime in the future that the command line approach directions will be revised so it will be possible to build A one jar using the command line approach? 
    Thanks again for all your time.

     
  • James
    James
    2011-12-06

    Hello Simon.
    I looked at the one-jar-appgen approach, this is for eclipse project? I do have a couple questions concerning thecomman line approach.  I took the contents of one-jar-ant-task-0.97.jar and put it in my BundlingTools dir.  Shoud I have src/main and src/lib ? because I just have main and lib dir next to your files.  The instructions said to delete src.
    And, I did get the musicSystemsOneJar.jar to run.  However, It did not build the db.   Now I see that I did not have the derby.jar present in the lib. I can not find my notes on that version now but I am trying to reproduce it with the derby.jar.
    Is my MANIFEST.MF correct?
    Thanks for your time

     
  • James
    James
    2011-12-06

    Manifest-Version: 1.0
    Ant-Version: Apache Ant 1.7.1
    Created-By: One-Jar 0.97 Ant taskdef
    One-Jar-Main-Class: com.simontuffs.onejar.sdk.Install
    One-Jar-Expand:
    One-Jar-Expand-Dir: ./one-jar-sdk-0.97
    One-Jar-Confirm-Expand: true
    One-Jar-Show-Expand: true
    Main-Class: com.simontuffs.onejar.Boot
    One-Jar-Main-Class: musicSystems.src.view.main.Main

     
  • James
    James
    2011-12-06

    Any additional examples or reading on the one-jar structure would be great at this point. There is stuff I do not comprhend about making one-jar work.
    thanks

     
  • P. Simon Tuffs
    P. Simon Tuffs
    2011-12-07

    Hi Steve:

    I looked at the one-jar-appgen approach, this is for eclipse project? I do have a couple questions concerning thecomman line approach.  I took the contents of one-jar-ant-task-0.97.jar and put it in my BundlingTools dir.  Shoud I have src/main and src/lib ? because I just have main and lib dir next to your files.  The instructions said to delete src.
    And, I did get the musicSystemsOneJar.jar to run.  However, It did not build the db.   Now I see that I did not have the derby.jar present in the lib. I can not find my notes on that version now but I am trying to reproduce it with the derby.jar.
    Is my MANIFEST.MF correct?

    Your manifest is mostly correct, you should remove the "One-Jar-Main-Class: com.simontuffs.onejar.sdk.Install" since it is overridden by the later definition of the entry point of your code: "One-Jar-Main-Class: musicSystems.src.view.main.Main"

    You are correct that one-jar-appgen makes an Eclipse-compatible project, but it is also usable as a stand-alone project with ant.  You can start with that project, delete the lib and main directory contents, add yours into it, and modify the One-Jar-Main class, then run ant and you will rebuild a new one-jar with your code in it.

    Regarding how one-jar works: the documentation on the website is as good as I have right now.  The structure of a minimal one-jar is shown below:

    one-jar.jar
    |  META-INF/MANIFEST.MF
    |  .version
    |  com/simontuffs/onejar
       |  Boot.class, …etc.
    |  doc/one-jar-license.txt
    |  main/main.jar
    |  lib/a.jar …etc.

    The launch process is controlled by the META-INF/MANIFEST.MF (which starts the one-jar bootstrap loader). This loader then reads the jar file, figures out where the main program is (from the One-Jar-Main-Class manifest entry), loads the lib & main jars into memory, and runs.

    In term of derby.jar: you will encounter a problem with JDBC, it cannot see "into" the one-jar to locate the derby.jar drivers.  You need to extract the derby.jar (using the One-Jar-Expand mechanism as documented), then extend the MANIFEST.MF Class-Path to point to the derby.jar. You can expand to the default working directory provided you have write permission:

    http://one-jar.sourceforge.net/index.php?page=details&file=manifest

    e.g. MANIFEST.MF

    Class-Path: ./jetty.jar
    One-Jar-Expand: lib/jetty.jar

    I hope this helps, I think you are very close to making this work for you.

     
  • P. Simon Tuffs
    P. Simon Tuffs
    2011-12-07

    I meant…

    Class-Path: derby.jar
    One-Jar-Expand: lib/derby.jar

     
  • Steve Howerton
    Steve Howerton
    2011-12-17

    In term of derby.jar: you will encounter a problem with JDBC, it cannot see "into" the one-jar to locate the derby.jar drivers.  You need to extract the derby.jar (using the One-Jar-Expand mechanism as documented), then extend the MANIFEST.MF Class-Path to point to the derby.jar. You can expand to the default working directory provided you have write permission:

    As far as write permission: Do I need to show some path to the C: Drive ? I sounds to me like you are saying that your program will expand the derby.jar within the main dir and the drivers will be visible to one-jar?  Or do I show a path to C:drive ex: .schoolOfDb\drivers dir Or is there more to the class path ?

    One-Jar-Expand-Dir:  schoolOfDb/drivers

    I am not at my computer to make any trial and errors yet but If my manifest is closer I will be able to try it and get back to you.
    If the drivers are visible: It looks like it should run.

    Manifest-Version: 1.0
    Ant-Version: Apache Ant 1.7.1
    Created-By: One-Jar 0.97 Ant taskdef
    Class-Path: derby.jar
    One-Jar-Expand: lib/derby.jar
    One-Jar-Expand-Dir: ./one-jar-sdk-0.97
    One-Jar-Confirm-Expand: true
    One-Jar-Show-Expand: true
    Main-Class: com.simontuffs.onejar.Boot
    One-Jar-Main-Class: musicSystems.src.view.main.Main

     
  • Steve Howerton
    Steve Howerton
    2011-12-17

    Manifest-Version: 1.0
    Ant-Version: Apache Ant 1.7.1
    Created-By: One-Jar 0.97 Ant taskdef
    Class-Path: derby.jar
    One-Jar-Expand: lib/derby.jar
    One-Jar-Expand-Dir:  .schoolOfDb/drivers
    One-Jar-Expand-Dir: ./one-jar-sdk-0.97
    One-Jar-Confirm-Expand: true
    One-Jar-Show-Expand: true
    Main-Class: com.simontuffs.onejar.Boot
    One-Jar-Main-Class: musicSystems.src.view.main.Main

     
  • James
    James
    2011-12-19

    I tried it again. something is still wrong. now it will not find my musicSystems package .
    musicSystems.src.view.main.Main

    Manifest-Version: 1.0
    Ant-Version: Apache Ant 1.7.1
    Created-By: One-Jar 0.97 Ant taskdef
    Class-Path: derby.jar
    One-Jar-Expand: lib/derby.jar
    One-Jar-Expand-Dir: ./one-jar-sdk-0.97
    One-Jar-Confirm-Expand: true
    One-Jar-Show-Expand: true
    One-Jar-Main-Class: com\simontuffs\onejar.Boot
    Main-Class: musicSystems.src.view.Main
    
    C:\Program Files\Java\jdk1.7.0_01\bin>jar -cvfm C:\Users\Steves\Documents\ceyesu
    mma\java_cache\my_projects\netbeans\musicSystems\target_musicSystems\musicSystem
    sOneJar.jar C:\Users\Steves\Documents\ceyesumma\java_cache\my_projects\netbeans\
    musicSystems\target_musicSystems\BundlingTools\META-INF\MANIFEST.MF
    added manifest
    C:\Program Files\Java\jdk1.7.0_01\bin>java -jar C:\Users\Steves\Documents\ceyesu
    mma\java_cache\my_projects\netbeans\musicSystems\target_musicSystems\musicSystem
    sOneJar.jar
    Error: Could not find or load main class musicSystems.src.view.main.Main
    C:\Program Files\Java\jdk1.7.0_01\bin>
    C:\Program Files\Java\jdk1.7.0_01\bin>jar -tvf C:\Users\Steves\Documents\ceyesum
    ma\java_cache\my_projects\netbeans\musicSystems\target_musicSystems\musicSystems
    OneJar.jar
         0 Sun Dec 18 10:52:12 CST 2011 META-INF/
       460 Sun Dec 18 10:52:12 CST 2011 META-INF/MANIFEST.MF
    C:\Program Files\Java\jdk1.7.0_01\bin>java -jar C:\Users\Steves\Documents\ceyesu
    mma\java_cache\my_projects\netbeans\musicSystems\target_musicSystems\musicSystem
    sOneJar.jar
    Error: Could not find or load main class musicSystems.src.view.main.Main
    C:\Program Files\Java\jdk1.7.0_01\bin>
    

    The build file for one jar: I made alterations to this build file(to follow) but I am trying to understand how it works

    <project name="one-jar-sdk" default="sdk">
        <property name="one-jar.dist.dir" value="${basedir}"/>   
        
        <property name="src.main.dir" location="${basedir}/src/main"/>
        <property name="src.lib.dir" location="${basedir}/src/lib"/>
        <property name="src.install.dir" location="${basedir}/src/install"/>
        <property name="lib.dir" location="${basedir}/lib"/>
        <property name="build.dir" location="${basedir}/build"/>   
        
        <property name="classes.dir" location="${basedir}/classes"/>
    
        <target name="init">
            <mkdir dir="${src.main.dir}"/>   
            <mkdir dir="${src.lib.dir}"/> 
            <mkdir dir="${lib.dir}"/>
            <mkdir dir="${classes.dir}/main"/>   
            <mkdir dir="${classes.dir}/lib"/>   
            <mkdir dir="${classes.dir}/src"/>   
            <mkdir dir="${build.dir}"/>   
        </target>   
        
        <import file="one-jar-ant-task.xml"/>
    
        <target name="hello" depends="init">
            <!-- Build lib.jar -->   
            <javac destdir="${classes.dir}/lib">
                <src path="${src.lib.dir}" />
            </javac>
            <jar destfile="${build.dir}/lib.jar" >
                <fileset dir="${classes.dir}/lib"/>
            </jar>   
            <!-- Build classes for main.jar -->   
            <javac destdir="${classes.dir}/main">
                <src path="${src.main.dir}" />
                <classpath path="${build.dir}/lib.jar"/>   
                <classpath>
                    <fileset dir="${src.lib.dir}"/>
                </classpath>
            </javac>
            <!-- Construct the One-JAR file -->   
            <one-jar destfile="hello.jar">
                <!-- hello.mf:
                
                Main-Class: com.simontuffs.onejar.Boot
                One-Jar-Main-Class: com.simontuffs.onejar.hello.Main
                -->
                <manifest>
                    <attribute name="One-Jar-Main-Class" value="com.simontuffs.onejar.hello.Main"/> 
                </manifest>
                <main>
                    <!-- Construct main.jar from classes and source code -->
                    <fileset dir="${classes.dir}/main"/>
                </main>
                <lib>
                    <fileset file="${build.dir}/lib.jar" />
                    <!-- This will copy the files in the SDK/lib dir to the lib folder in the jar file-->
                    <fileset dir="${lib.dir}"/>
                </lib>
            </one-jar>
            <echo>
              Now you can run the Hello One-JAR example using 
              $ java -jar hello.jar
            </echo>   
               
        </target>
    
        <target name="sdk">
            <!-- Rebuild this SDK using the One-JAR task. -->   
            <echo>Building sdk ${one-jar.version}</echo>
            <mkdir dir="${classes.dir}/install"/>   
            <javac destdir="${classes.dir}/install">
                <src path="${src.install.dir}" />
            </javac>
            <delete file="one-jar-sdk-${one-jar.version}.jar"/>
            <one-jar destfile="one-jar-sdk-${one-jar.version}.jar">
                <!-- one-jar-sdk.mf:
                
                Main-Class: com.simontuffs.onejar.Boot
                One-Jar-Main-Class: com.simontuffs.onejar.sdk.Install
                One-Jar-Expand: 
                One-Jar-Expand-Dir: ./one-jar-sdk-${one-jar.version}
                One-Jar-Show-Expand: true           
                -->
                <manifest>
                    <attribute name="One-Jar-Main-Class" value="com.simontuffs.onejar.sdk.Install"/>
                    <!-- Note: One-Jar-Expand is a list of paths to expand: empty is all -->
                    <attribute name="One-Jar-Expand" value=""/>
                    <attribute name="One-Jar-Expand-Dir" value="./one-jar-sdk-${one-jar.version}"/>
                    <attribute name="One-Jar-Confirm-Expand" value="true"/>
                    <attribute name="One-Jar-Show-Expand" value="true"/>
                </manifest>
                <fileset dir=".">
                    <include name="one-jar-ant-${one-jar.version}.jar"/>   
                    <include name="src/main/**"/>   
                    <include name="src/lib/**"/>   
                    <include name="src/install/**"/>   
                    <include name="build.xml"/>   
                    <include name="README.txt"/>   
                    <include name="one-jar-ant-task*"/>   
                    <include name="*.mf"/>   
                    <include name=".*"/>   
                    <exclude name=".version"/>
                </fileset>
                <main>
                    <fileset dir="${classes.dir}/install"/>
                </main>
            </one-jar> 
        </target>
    
        <target name="clean">
            <delete dir="${classes.dir}"/>
            <delete dir="${build.dir}"/>
        </target>   
        
    </project>
    

    I changed the hello.jar to musicSystems.jar. this is my project dist .jar created by netbeans
    I also changed the

     <manifest>
                    <attribute name="One-Jar-Main-Class" value="com.simontuffs.onejar.hello.Main"/> 
     </manifest>
    

    to: because this is where my projects main is:

    <manifest>
                    <attribute name="One-Jar-Main-Class" value="musicSystems.src.view.Main"/> 
    </manifest>
    

    The the MANIFEST.MF describes this as the Main Class:

    One-Jar-Main-Class: com\simontuffs\onejar.Boot
    Main-Class: musicSystems.src.view.Main
    

    altered one jar build file:

    <project name="one-jar-sdk" default="sdk">
      <property name="one-jar.dist.dir" value="${basedir}"/>
      <property name="src.main.dir" location="${basedir}/src/main"/>
      <property name="src.lib.dir" location="${basedir}/src/lib"/>
      <property name="src.install.dir" location="${basedir}/src/install"/>
      <property name="lib.dir" location="${basedir}/lib"/>
      <property name="build.dir" location="${basedir}/build"/>
      <property name="classes.dir" location="${basedir}/classes"/>
      <target name="init">
        <mkdir dir="${src.main.dir}"/>
        <mkdir dir="${src.lib.dir}"/>
        <mkdir dir="${lib.dir}"/>
        <mkdir dir="${classes.dir}/main"/>
        <mkdir dir="${classes.dir}/lib"/>
        <mkdir dir="${classes.dir}/src"/>
        <mkdir dir="${build.dir}"/>
      </target>
      <import file="one-jar-ant-task.xml"/>
      <target name="musicSystems" depends="init">
        <!-- Build lib.jar -->
        <javac destdir="${classes.dir}/lib">
          <src path="${src.lib.dir}" />
        </javac>
        <jar destfile="${build.dir}/lib.jar" >
          <fileset dir="${classes.dir}/lib"/>
        </jar>
        <!-- Build classes for main.jar -->
        <javac destdir="${classes.dir}/main">
          <src path="${src.main.dir}" />
          <classpath path="${build.dir}/lib.jar"/>
          <classpath>
            <fileset dir="${src.lib.dir}"/>
          </classpath>
        </javac>
        <!-- Construct the One-JAR file -->
        <one-jar destfile="musicSystems.jar">
          <!-- MANIFEST.MF:
                
                Manifest-Version: 1.0
    Ant-Version: Apache Ant 1.7.1
    Created-By: One-Jar 0.97 Ant taskdef
    Class-Path: derby.jar
    One-Jar-Expand: lib/derby.jar
    One-Jar-Expand-Dir: ./one-jar-sdk-0.97
    One-Jar-Confirm-Expand: true
    One-Jar-Show-Expand: true
    One-Jar-Main-Class: com\simontuffs\onejar.Boot
    Main-Class: musicSystems.src.view.Main 
                -->
          <manifest>
            <attribute name="One-Jar-Main-Class" value="musicSystems.src.view.Main"/>
          </manifest>
          <main>
            <!-- Construct main.jar from classes and source code -->
            <fileset dir="${classes.dir}/main"/>
          </main>
          <lib>
            <fileset file="${build.dir}/lib.jar" />
            <!-- This will copy the files in the SDK/lib dir to the lib folder in the jar file-->
            <fileset dir="${lib.dir}"/>
          </lib>
        </one-jar>
        <echo>Now you can run the Musicsystems One-JAR example using 
          $ java -jar musicSystems.jar</echo>
      </target>
      <target name="sdk">
        <!-- Rebuild this SDK using the One-JAR task. -->
        <echo>Building sdk ${one-jar.version}</echo>
        <mkdir dir="${classes.dir}/install"/>
        <javac destdir="${classes.dir}/install">
          <src path="${src.install.dir}" />
        </javac>
        <delete file="one-jar-sdk-${one-jar.version}.jar"/>
        <one-jar destfile="one-jar-sdk-${one-jar.version}.jar">
          <!-- one-jar-sdk.mf:
                
                Main-Class: com.simontuffs.onejar.Boot
                One-Jar-Main-Class: com.simontuffs.onejar.sdk.Install
                One-Jar-Expand: 
                One-Jar-Expand-Dir: ./one-jar-sdk-${one-jar.version}
                One-Jar-Show-Expand: true           
                -->
          <manifest>
            <attribute name="One-Jar-Main-Class" value="com.simontuffs.onejar.sdk.Install"/>
            <!-- Note: One-Jar-Expand is a list of paths to expand: empty is all -->
            <attribute name="One-Jar-Expand" value=""/>
            <attribute name="One-Jar-Expand-Dir" value="./one-jar-sdk-${one-jar.version}"/>
            <attribute name="One-Jar-Confirm-Expand" value="true"/>
            <attribute name="One-Jar-Show-Expand" value="true"/>
          </manifest>
          <fileset dir=".">
            <include name="one-jar-ant-${one-jar.version}.jar"/>
            <include name="src/main/**"/>
            <include name="src/lib/**"/>
            <include name="src/install/**"/>
            <include name="build.xml"/>
            <include name="README.txt"/>
            <include name="one-jar-ant-task*"/>
            <include name="*.mf"/>
            <include name=".*"/>
            <exclude name=".version"/>
          </fileset>
          <main>
            <fileset dir="${classes.dir}/install"/>
          </main>
        </one-jar>
      </target>
      <target name="clean">
        <delete dir="${classes.dir}"/>
        <delete dir="${build.dir}"/>
      </target>
    </project>
    

    i tried to have the MANIFEST.MF expand the derby.jar to have access to the driver.  Does the build file
    need to do the same.  I noticed the existing tag:

    <manifest>
            <attribute name="One-Jar-Main-Class" value="com.simontuffs.onejar.sdk.Install"/>
            <!-- Note: One-Jar-Expand is a list of paths to expand: empty is all -->
            <attribute name="One-Jar-Expand" value=""/>
            <attribute name="One-Jar-Expand-Dir" value="./one-jar-sdk-${one-jar.version}"/>
            <attribute name="One-Jar-Confirm-Expand" value="true"/>
            <attribute name="One-Jar-Show-Expand" value="true"/>
          </manifest>
    

    Thanks for your time.

     
  • James
    James
    2011-12-19

    I hope this can be read better:

    The build file for one jar: I made alterations to this build file(to follow) but I am trying to understand how it works

    <project name="one-jar-sdk" default="sdk">

        <property name="one-jar.dist.dir" value="${basedir}"/>  
       
        <property name="src.main.dir" location="${basedir}/src/main"/>
        <property name="src.lib.dir" location="${basedir}/src/lib"/>
        <property name="src.install.dir" location="${basedir}/src/install"/>
    <property name="lib.dir" location="${basedir}/lib"/>
        <property name="build.dir" location="${basedir}/build"/>  
       
        <property name="classes.dir" location="${basedir}/classes"/>  

        <target name="init">
            <mkdir dir="${src.main.dir}"/>  
            <mkdir dir="${src.lib.dir}"/>
        <mkdir dir="${lib.dir}"/>
            <mkdir dir="${classes.dir}/main"/>  
            <mkdir dir="${classes.dir}/lib"/>  
            <mkdir dir="${classes.dir}/src"/>  
            <mkdir dir="${build.dir}"/>  
        </target>  
       
        <import file="one-jar-ant-task.xml"/>  

        <target name="hello" depends="init">
            <!- Build lib.jar ->  
            <javac destdir="${classes.dir}/lib">
                <src path="${src.lib.dir}" />
            </javac>
            <jar destfile="${build.dir}/lib.jar" >
                <fileset dir="${classes.dir}/lib"/>
            </jar>  
            <!- Build classes for main.jar ->  
            <javac destdir="${classes.dir}/main">
                <src path="${src.main.dir}" />
                <classpath path="${build.dir}/lib.jar"/>  
                <classpath>
            <fileset dir="${src.lib.dir}"/>
                </classpath>
            </javac>
            <!- Construct the One-JAR file ->  
            <one-jar destfile="hello.jar">
                <!- hello.mf:
               
                Main-Class: com.simontuffs.onejar.Boot
                One-Jar-Main-Class: com.simontuffs.onejar.hello.Main
                ->
                <manifest>
                    <attribute name="One-Jar-Main-Class" value="com.simontuffs.onejar.hello.Main"/>
                </manifest>
                <main>
                    <!- Construct main.jar from classes and source code ->
                    <fileset dir="${classes.dir}/main"/>
                </main>
                <lib>
                    <fileset file="${build.dir}/lib.jar" />

                <!- This will copy the files in the SDK/lib dir to the lib folder in the jar file->
        <fileset dir="${lib.dir}"/>

                </lib>
            </one-jar>
            <echo>
              Now you can run the Hello One-JAR example using
              $ java -jar hello.jar
            </echo>  
              
        </target>

        <target name="sdk">
            <!- Rebuild this SDK using the One-JAR task. ->  
        <echo>Building sdk ${one-jar.version}</echo>
            <mkdir dir="${classes.dir}/install"/>  
            <javac destdir="${classes.dir}/install">
                <src path="${src.install.dir}" />
            </javac>
            <delete file="one-jar-sdk-${one-jar.version}.jar"/>
            <one-jar destfile="one-jar-sdk-${one-jar.version}.jar">
                <!- one-jar-sdk.mf:
               
                Main-Class: com.simontuffs.onejar.Boot
                One-Jar-Main-Class: com.simontuffs.onejar.sdk.Install
                One-Jar-Expand:
                One-Jar-Expand-Dir: ./one-jar-sdk-${one-jar.version}
                One-Jar-Show-Expand: true          
                ->
                <manifest>
                    <attribute name="One-Jar-Main-Class" value="com.simontuffs.onejar.sdk.Install"/>
                    <!- Note: One-Jar-Expand is a list of paths to expand: empty is all ->
                <attribute name="One-Jar-Expand" value=""/>
                    <attribute name="One-Jar-Expand-Dir" value="./one-jar-sdk-${one-jar.version}"/>
                <attribute name="One-Jar-Confirm-Expand" value="true"/>
                    <attribute name="One-Jar-Show-Expand" value="true"/>
                </manifest>
                <fileset dir=".">
                    <include name="one-jar-ant-${one-jar.version}.jar"/>  
                    <include name="src/main/**"/>  
                    <include name="src/lib/**"/>  
                    <include name="src/install/**"/>  
                    <include name="build.xml"/>  
                    <include name="README.txt"/>  
                    <include name="one-jar-ant-task*"/>  
                    <include name="*.mf"/>  
                    <include name=".*"/>  
                <exclude name=".version"/>
                </fileset>
                <main>
                    <fileset dir="${classes.dir}/install"/>
                </main>
            </one-jar>
        </target>  

        <target name="clean">
            <delete dir="${classes.dir}"/>
            <delete dir="${build.dir}"/>
        </target>  
       
    </project>

    I changed the hello.jar to musicSystems.jar. this is my project dist .jar created by netbeans
    I also changed the

     <manifest>
                    <attribute name="One-Jar-Main-Class" value="com.simontuffs.onejar.hello.Main"/> 
     </manifest>
    

    to: because this is where my projects main is:

    <manifest>
                    <attribute name="One-Jar-Main-Class" value="musicSystems.src.view.Main"/> 
    </manifest>
    

    The the MANIFEST.MF describes this as the Main Class:

    One-Jar-Main-Class: com\simontuffs\onejar.Boot
    Main-Class: musicSystems.src.view.Main 
    altered one jar build file:
    <project name="one-jar-sdk" default="sdk">
      <property name="one-jar.dist.dir" value="${basedir}"/>
      <property name="src.main.dir" location="${basedir}/src/main"/>
      <property name="src.lib.dir" location="${basedir}/src/lib"/>
      <property name="src.install.dir" location="${basedir}/src/install"/>
      <property name="lib.dir" location="${basedir}/lib"/>
      <property name="build.dir" location="${basedir}/build"/>
      <property name="classes.dir" location="${basedir}/classes"/>
      <target name="init">
        <mkdir dir="${src.main.dir}"/>
        <mkdir dir="${src.lib.dir}"/>
        <mkdir dir="${lib.dir}"/>
        <mkdir dir="${classes.dir}/main"/>
        <mkdir dir="${classes.dir}/lib"/>
        <mkdir dir="${classes.dir}/src"/>
        <mkdir dir="${build.dir}"/>
      </target>
      <import file="one-jar-ant-task.xml"/>
      <target name="musicSystems" depends="init">
        <!-- Build lib.jar -->
        <javac destdir="${classes.dir}/lib">
          <src path="${src.lib.dir}" />
        </javac>
        <jar destfile="${build.dir}/lib.jar" >
          <fileset dir="${classes.dir}/lib"/>
        </jar>
        <!-- Build classes for main.jar -->
        <javac destdir="${classes.dir}/main">
          <src path="${src.main.dir}" />
          <classpath path="${build.dir}/lib.jar"/>
          <classpath>
            <fileset dir="${src.lib.dir}"/>
          </classpath>
        </javac>
        <!-- Construct the One-JAR file -->
        <one-jar destfile="musicSystems.jar">
          <!-- MANIFEST.MF:
                
                Manifest-Version: 1.0
    Ant-Version: Apache Ant 1.7.1
    Created-By: One-Jar 0.97 Ant taskdef
    Class-Path: derby.jar
    One-Jar-Expand: lib/derby.jar
    One-Jar-Expand-Dir: ./one-jar-sdk-0.97
    One-Jar-Confirm-Expand: true
    One-Jar-Show-Expand: true
    One-Jar-Main-Class: com\simontuffs\onejar.Boot
    Main-Class: musicSystems.src.view.Main 
                -->
          <manifest>
            <attribute name="One-Jar-Main-Class" value="musicSystems.src.view.Main"/>
          </manifest>
          <main>
            <!-- Construct main.jar from classes and source code -->
            <fileset dir="${classes.dir}/main"/>
          </main>
          <lib>
            <fileset file="${build.dir}/lib.jar" />
            <!-- This will copy the files in the SDK/lib dir to the lib folder in the jar file-->
            <fileset dir="${lib.dir}"/>
          </lib>
        </one-jar>
        <echo>Now you can run the Musicsystems One-JAR example using 
          $ java -jar musicSystems.jar</echo>
      </target>
      <target name="sdk">
        <!-- Rebuild this SDK using the One-JAR task. -->
        <echo>Building sdk ${one-jar.version}</echo>
        <mkdir dir="${classes.dir}/install"/>
        <javac destdir="${classes.dir}/install">
          <src path="${src.install.dir}" />
        </javac>
        <delete file="one-jar-sdk-${one-jar.version}.jar"/>
        <one-jar destfile="one-jar-sdk-${one-jar.version}.jar">
          <!-- one-jar-sdk.mf:
                
                Main-Class: com.simontuffs.onejar.Boot
                One-Jar-Main-Class: com.simontuffs.onejar.sdk.Install
                One-Jar-Expand: 
                One-Jar-Expand-Dir: ./one-jar-sdk-${one-jar.version}
                One-Jar-Show-Expand: true           
                -->
          <manifest>
            <attribute name="One-Jar-Main-Class" value="com.simontuffs.onejar.sdk.Install"/>
            <!-- Note: One-Jar-Expand is a list of paths to expand: empty is all -->
            <attribute name="One-Jar-Expand" value=""/>
            <attribute name="One-Jar-Expand-Dir" value="./one-jar-sdk-${one-jar.version}"/>
            <attribute name="One-Jar-Confirm-Expand" value="true"/>
            <attribute name="One-Jar-Show-Expand" value="true"/>
          </manifest>
          <fileset dir=".">
            <include name="one-jar-ant-${one-jar.version}.jar"/>
            <include name="src/main/**"/>
            <include name="src/lib/**"/>
            <include name="src/install/**"/>
            <include name="build.xml"/>
            <include name="README.txt"/>
            <include name="one-jar-ant-task*"/>
            <include name="*.mf"/>
            <include name=".*"/>
            <exclude name=".version"/>
          </fileset>
          <main>
            <fileset dir="${classes.dir}/install"/>
          </main>
        </one-jar>
      </target>
      <target name="clean">
        <delete dir="${classes.dir}"/>
        <delete dir="${build.dir}"/>
      </target>
    </project>
    
     
  • James
    James
    2011-12-19

    This is my build file that I hope can be read better:

    altered one jar build file:

    <project name="one-jar-sdk" default="sdk">
      <property name="one-jar.dist.dir" value="${basedir}"/>
      <property name="src.main.dir" location="${basedir}/src/main"/>
      <property name="src.lib.dir" location="${basedir}/src/lib"/>
      <property name="src.install.dir" location="${basedir}/src/install"/>
      <property name="lib.dir" location="${basedir}/lib"/>
      <property name="build.dir" location="${basedir}/build"/>
      <property name="classes.dir" location="${basedir}/classes"/>
      <target name="init">
        <mkdir dir="${src.main.dir}"/>
        <mkdir dir="${src.lib.dir}"/>
        <mkdir dir="${lib.dir}"/>
        <mkdir dir="${classes.dir}/main"/>
        <mkdir dir="${classes.dir}/lib"/>
        <mkdir dir="${classes.dir}/src"/>
        <mkdir dir="${build.dir}"/>
      </target>
      <import file="one-jar-ant-task.xml"/>
      <target name="musicSystems" depends="init">
        <!- Build lib.jar ->
        <javac destdir="${classes.dir}/lib">
          <src path="${src.lib.dir}" />
        </javac>
        <jar destfile="${build.dir}/lib.jar" >
          <fileset dir="${classes.dir}/lib"/>
        </jar>
        <!- Build classes for main.jar ->
        <javac destdir="${classes.dir}/main">
          <src path="${src.main.dir}" />
          <classpath path="${build.dir}/lib.jar"/>
          <classpath>
            <fileset dir="${src.lib.dir}"/>
          </classpath>
        </javac>
        <!- Construct the One-JAR file ->
        <one-jar destfile="musicSystems.jar">
          <!- MANIFEST.MF:
               
                Manifest-Version: 1.0
    Ant-Version: Apache Ant 1.7.1
    Created-By: One-Jar 0.97 Ant taskdef
    Class-Path: derby.jar
    One-Jar-Expand: lib/derby.jar
    One-Jar-Expand-Dir: ./one-jar-sdk-0.97
    One-Jar-Confirm-Expand: true
    One-Jar-Show-Expand: true
    One-Jar-Main-Class: com\simontuffs\onejar.Boot
    Main-Class: musicSystems.src.view.Main

                ->
          <manifest>
            <attribute name="One-Jar-Main-Class" value="musicSystems.src.view.Main"/>
          </manifest>
          <main>
            <!- Construct main.jar from classes and source code ->
            <fileset dir="${classes.dir}/main"/>
          </main>
          <lib>
            <fileset file="${build.dir}/lib.jar" />
            <!- This will copy the files in the SDK/lib dir to the lib folder in the jar file->
            <fileset dir="${lib.dir}"/>
          </lib>
        </one-jar>
        <echo>Now you can run the Musicsystems One-JAR example using
          $ java -jar musicSystems.jar</echo>
      </target>
      <target name="sdk">
        <!- Rebuild this SDK using the One-JAR task. ->
        <echo>Building sdk ${one-jar.version}</echo>
        <mkdir dir="${classes.dir}/install"/>
        <javac destdir="${classes.dir}/install">
          <src path="${src.install.dir}" />
        </javac>
        <delete file="one-jar-sdk-${one-jar.version}.jar"/>
        <one-jar destfile="one-jar-sdk-${one-jar.version}.jar">
          <!- one-jar-sdk.mf:
               
                Main-Class: com.simontuffs.onejar.Boot
                One-Jar-Main-Class: com.simontuffs.onejar.sdk.Install
                One-Jar-Expand:
                One-Jar-Expand-Dir: ./one-jar-sdk-${one-jar.version}
                One-Jar-Show-Expand: true          
                ->
          <manifest>
            <attribute name="One-Jar-Main-Class" value="com.simontuffs.onejar.sdk.Install"/>
            <!- Note: One-Jar-Expand is a list of paths to expand: empty is all ->
            <attribute name="One-Jar-Expand" value=""/>
            <attribute name="One-Jar-Expand-Dir" value="./one-jar-sdk-${one-jar.version}"/>
            <attribute name="One-Jar-Confirm-Expand" value="true"/>
            <attribute name="One-Jar-Show-Expand" value="true"/>
          </manifest>
          <fileset dir=".">
            <include name="one-jar-ant-${one-jar.version}.jar"/>
            <include name="src/main/**"/>
            <include name="src/lib/**"/>
            <include name="src/install/**"/>
            <include name="build.xml"/>
            <include name="README.txt"/>
            <include name="one-jar-ant-task*"/>
            <include name="*.mf"/>
            <include name=".*"/>
            <exclude name=".version"/>
          </fileset>
          <main>
            <fileset dir="${classes.dir}/install"/>
          </main>
        </one-jar>
      </target>
      <target name="clean">
        <delete dir="${classes.dir}"/>
        <delete dir="${build.dir}"/>
      </target>
    </project>

     
  • P. Simon Tuffs
    P. Simon Tuffs
    2011-12-21

    I think you're really close here: you have the Main-Class and One-Jar-Main-Class manifest attributes reversed.  Instead of:

    One-Jar-Main-Class: com\simontuffs\onejar.Boot
    Main-Class: musicSystems.src.view.Main
    

    please try:

    Main-Class: com\simontuffs\onejar.Boot
    One-Jar-Main-Class: musicSystems.src.view.Main
    

    "Main-Class" is the "standard" Java JAR main class launcher, used by "java -jar" to know what to execute. It should point to the com.simontuffs.onejar.Boot class, which then reads the one-jar and launches the class pointed to by "One-Jar-Main-Class" - your application.

    Good luck.

     
  • James
    James
    2011-12-22

    Hello Simmon:

    I will have to try the info from your last post and get back to you. Thanks again for all the time you have spent
    showing me how this works.
    I was planning on posting todays results. I edited this post to reflect the changes you have described.
    I may or may not have tried that configuration. so the Main class: and the One Jar main class are new to this post
    but the rest of the info is consistent to my last attemp. Do you see any problems with how I tried to run oneJar?

    Will I have to change that build.xml ?  I reverted back to the original on this attemp because I did not
    think that it was being used?

    My Netbeans project compiles and runs. It creates the classes in musicSystems.build.classes.view
    it also creates a musicSystem.jar in musicSystems.dist I use these in my MANIFEST.MF

    Manifest-Version: 1.0
    Ant-Version: Apache Ant 1.7.1
    Created-By: One-Jar 0.97 Ant taskdef
    Class-Path: derby.jar
    One-Jar-Expand: lib/derby.jar
    One-Jar-Expand-Dir: ./one-jar-sdk-0.97
    One-Jar-Confirm-Expand: true
    One-Jar-Show-Expand: true
    One-Jar-Main-Class: musicSystems.build.classes.view.Main
    Main-Class: com.simontuffs.onejar.Boot

    Main-Class: com\simontuffs\onejar.Boot One-Jar-Main-Class: musicSystems.src.view.Main

    "Main-Class" is the "standard" Java JAR main class launcher, used by "java -jar" to know what to execute. It should point to the com.simontuffs.onejar.Boot class, which then reads the one-jar and launches the class pointed to by "One-Jar-Main-Class" - your application.

    I run OneJar and it creates the jar file and shows that the manifest was added. It also
    creates the musicSystemsOneJar.jar.
    When I double click or try to run the musicSystemsOneJar.jar it can not find my
    Main. Is there a reason the main class can not be loaded?
    Thanks.
    Merry Christmass and Happy New Year.

    BundlingTools act as my root
    in BundlingTools I have all the content of one-jar-sdk-0.97.zip
    I deleted the original src dir.
    I then added a main dir where I put my apps jar musicSystems.jar
    and I added a lib dir where I put my .jars and .xml and my properties files

    I create the musicSystemsOneJar and it adds it to BundlingTools Dir also.

    C:\Program Files\Java\jdk1.7.0_01>cd bin
    C:\Program Files\Java\jdk1.7.0_01\bin>jar -cvfm C:\Users\Steves\Documents\ceyesu
    mma\java_cache\my_projects\netbeans\musicSystems\target_musicSystems\musicSystem
    sOneJar.jar C:\Users\Steves\Documents\ceyesumma\java_cache\my_projects\netbeans\
    musicSystems\target_musicSystems\BundlingTools\META-INF\MANIFEST.MF
    added manifest
    C:\Program Files\Java\jdk1.7.0_01\bin>
    C:\Program Files\Java\jdk1.7.0_01\bin>
    C:\Program Files\Java\jdk1.7.0_01\bin>jar -cvfm C:\Users\Steves\Documents\ceyesu
    mma\java_cache\my_projects\netbeans\musicSystems\target_musicSystems\BundlingToo
    ls\musicSystemsOneJar.jar C:\Users\Steves\Documents\ceyesumma\java_cache\my_proj
    ects\netbeans\musicSystems\target_musicSystems\BundlingTools\META-INF\MANIFEST.M
    F
    added manifest
    C:\Program Files\Java\jdk1.7.0_01\bin>
    C:\Program Files\Java\jdk1.7.0_01\bin>jar -tvf C:\Users\Steves\Documents\ceyesum
    ma\java_cache\my_projects\netbeans\musicSystems\target_musicSystems\BundlingTool
    s\musicSystemsOneJar.jar
         0 Wed Dec 21 08:09:58 CST 2011 META-INF/
       304 Wed Dec 21 08:09:58 CST 2011 META-INF/MANIFEST.MF
    C:\Program Files\Java\jdk1.7.0_01\bin>
    C:\Program Files\Java\jdk1.7.0_01\bin>java -jar -Xmx256m C:\Users\Steves\Documen
    ts\ceyesumma\java_cache\my_projects\netbeans\musicSystems\target_musicSystems\Bu
    ndlingTools\musicSystemsOneJar.jar
    Error: Could not find or load main class com.simontuffs.onejar.Boot
    C:\Program Files\Java\jdk1.7.0_01\bin>
    

    response from simon:
    Main-Class: com\simontuffs\onejar.Boot One-Jar-Main-Class: musicSystems.src.view.Main

    "Main-Class" is the "standard" Java JAR main class launcher, used by "java -jar" to know what to execute. It should point to the com.simontuffs.onejar.Boot class, which then reads the one-jar and launches the class pointed to by "One-Jar-Main-Class" - your application.