I have successfully created a Java program that runs fine on my development computer, both in Netbeans and with the .jar file (double clicking). The problem is that it won't start on computers without JDK or without starting via command line with java -jar jarfile.jar (note that it won't start without the -jar flag). 
Neither on the development computer the jar file runs without the -jar flag on command line.
The error I'm getting in all the situations where the program doesn't start is the following.
S:\Folder>Program.jar
Exception in thread "main" java.lang.NoClassDefFoundError: S:\Folder\Program/jar
Caused by: java.lang.ClassNotFoundException: S:\Folder\Program.jar
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: S:\Folder\Program.jar. Program will exit.
The file structure of Program.jar looks this:
Program.jar
    binlib
        build.xml
        manifest.mf
        onejar.mf
        one-jar-ant-task.xml
    com
        simontuffs
            onejar
                a lot of classes related to OneJar
    doc
        one-jar-license.txt
    lib
        itextpdf-5.3.3.jar
    main
        main.jar
            my
                package
                    all the classes related to my program
            META-INF
                manifest.mf
            Resources
                all my programs resources
            txt
                more resources
    META-INF
        MANIFEST.MF
    .version
    OneJar.class
The project is compiled with Netbeans and OneJar to get all the required libraries (in this case iText) in the same jar file to help the users - only one file is easier than two files.
The MANIFEST.MF file in the META-INF folder in the root of the jar file contains the following:
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.1
Created-By: One-Jar 0.97 Ant taskdef
Main-Class: com.simontuffs.onejar.Boot
One-Jar-Main-Class: my.package.MainClass
Class-Path: lib/itextpdf-5.3.3.jar
Note that this is automatically generated by OneJar so I suppose it's right though the real path to the main class also contains /main/main.jar/ if the path is related to the root.
The MANIFEST.MF in the inner jar file (the actual program) is empty. The one in binlib folder contains the following:
Manifest-Version: 1.0
X-COMMENT: Main-Class will be added automatically by build
Main-Class: my.package.MainClass
How do I get the jar running?
 
     
     
    