[NeverMind] Can't run game outside IDE

Yesterday I was able to “Clean and Build” and send the output jar file to a friend to play with.

Today, the jar file says “Error: Could not find or load main class”

I tried renaming the main class. I tried cleaning and rebuilding all the other projects it depends on. I tried restarting the IDE. I can start the game by right clicking on the project and selecting “Run” or “Debug”, but I can’t run it via command line.

If I open project properties → Run → Main Class it says “NuWorld.NuWorldMain”, and if I click Browse, its the only option.

My main class is in package NuWorld.NuWorldMain

// Global starting point
    public static void main(String[] args) {
        NuWorldMain app = new NuWorldMain();
        app.start();
    }

When I try to run:

E:\MonkeyProjects\NuWorld\dist>C:“Program Files”\Java\jdk1.8.0_74/bin/java -jar “E:\MonkeyProjects\NuWorld\dist\NuWorld.jar”
Error: Could not find or load main class Files\Java\jdk1.8.0_74.bin.java -jar E
:\MonkeyProjects\NuWorld\dist\NuWorld.jar

Buildoutput:

ant -f E:\\MonkeyProjects\\NuWorld clean jar
Building jar: E:\MonkeyProjects\NuWorld\build\assets.jar
init:
deps-clean:
Updating property file: E:\MonkeyProjects\NuWorld\build\built-clean.properties
Duplicated project name in import. Project assets-impl defined first in E:\MonkeyProjects\NuWorld\nbproject\assets-impl.xml and again in E:\MonkeyProjects\jMonkeyEngine-Console\nbproject\assets-impl.xml
Building jar: E:\MonkeyProjects\jMonkeyEngine-Console\build\assets.jar
BasicGameTemplate.init:
BasicGameTemplate.deps-clean:
Updating property file: E:\MonkeyProjects\NuWorld\build\built-clean.properties
Deleting directory E:\MonkeyProjects\jMonkeyEngine-Console\build
BasicGameTemplate.clean:
Duplicated project name in import. Project assets-impl defined first in E:\MonkeyProjects\NuWorld\nbproject\assets-impl.xml and again in E:\MonkeyProjects\cubes\Cubes\nbproject\assets-impl.xml
Building jar: E:\MonkeyProjects\cubes\Cubes\build\cubes-assets.jar
BasicGameTemplate.init:
BasicGameTemplate.deps-clean:
Updating property file: E:\MonkeyProjects\NuWorld\build\built-clean.properties
Deleting directory E:\MonkeyProjects\cubes\Cubes\build
BasicGameTemplate.clean:
Duplicated project name in import. Project assets-impl defined first in E:\MonkeyProjects\NuWorld\nbproject\assets-impl.xml and again in E:\MonkeyProjects\NuWorldServer\nbproject\assets-impl.xml
Building jar: E:\MonkeyProjects\NuWorldServer\build\assets.jar
BasicGameTemplate.init:
BasicGameTemplate.deps-clean:
Updating property file: E:\MonkeyProjects\NuWorld\build\built-clean.properties
Deleting directory E:\MonkeyProjects\NuWorldServer\build
BasicGameTemplate.clean:
Deleting directory E:\MonkeyProjects\NuWorld\build
clean:
Building jar: E:\MonkeyProjects\NuWorld\build\assets.jar
init:
deps-jar:
Updating property file: E:\MonkeyProjects\NuWorld\build\built-jar.properties
Duplicated project name in import. Project assets-impl defined first in E:\MonkeyProjects\NuWorld\nbproject\assets-impl.xml and again in E:\MonkeyProjects\jMonkeyEngine-Console\nbproject\assets-impl.xml
Building jar: E:\MonkeyProjects\jMonkeyEngine-Console\build\assets.jar
BasicGameTemplate.init:
BasicGameTemplate.deps-jar:
Updating property file: E:\MonkeyProjects\NuWorld\build\built-jar.properties
Created dir: E:\MonkeyProjects\jMonkeyEngine-Console\build\classes
Created dir: E:\MonkeyProjects\jMonkeyEngine-Console\build\empty
Compiling 7 source files to E:\MonkeyProjects\jMonkeyEngine-Console\build\classes
warning: [options] bootstrap class path not set in conjunction with -source 1.5
warning: [options] source value 1.5 is obsolete and will be removed in a future release
warning: [options] target value 1.5 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
Note: E:\MonkeyProjects\jMonkeyEngine-Console\src\strongdk\examples\TestConsoleAppState.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
4 warnings
Creating empty E:\MonkeyProjects\jMonkeyEngine-Console\build\classes\strongdk\jme\appstate\console\package-info.class
Copied 1 empty directory to 1 empty directory under E:\MonkeyProjects\jMonkeyEngine-Console\build\classes
BasicGameTemplate.compile:
Created dir: E:\MonkeyProjects\jMonkeyEngine-Console\dist
Copying 1 file to E:\MonkeyProjects\jMonkeyEngine-Console\build
Copy libraries to E:\MonkeyProjects\jMonkeyEngine-Console\dist\lib.
Building jar: E:\MonkeyProjects\jMonkeyEngine-Console\dist\Console.jar
To run this application from the command line without Ant, try:
C:\Program Files\Java\jdk1.8.0_74/bin/java -jar "E:\MonkeyProjects\jMonkeyEngine-Console\dist\Console.jar"
BasicGameTemplate.jar:
Duplicated project name in import. Project assets-impl defined first in E:\MonkeyProjects\NuWorld\nbproject\assets-impl.xml and again in E:\MonkeyProjects\cubes\Cubes\nbproject\assets-impl.xml
Building jar: E:\MonkeyProjects\cubes\Cubes\build\cubes-assets.jar
BasicGameTemplate.init:
BasicGameTemplate.deps-jar:
Updating property file: E:\MonkeyProjects\NuWorld\build\built-jar.properties
Created dir: E:\MonkeyProjects\cubes\Cubes\build\classes
Created dir: E:\MonkeyProjects\cubes\Cubes\build\empty
Compiling 37 source files to E:\MonkeyProjects\cubes\Cubes\build\classes
warning: [options] bootstrap class path not set in conjunction with -source 1.5
warning: [options] source value 1.5 is obsolete and will be removed in a future release
warning: [options] target value 1.5 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
Note: E:\MonkeyProjects\cubes\Cubes\src\com\cubes\models\BlockModel.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
4 warnings
BasicGameTemplate.compile:
Created dir: E:\MonkeyProjects\cubes\Cubes\dist
Copying 1 file to E:\MonkeyProjects\cubes\Cubes\build
Copy libraries to E:\MonkeyProjects\cubes\Cubes\dist\lib.
Building jar: E:\MonkeyProjects\cubes\Cubes\dist\Cubes.jar
To run this application from the command line without Ant, try:
C:\Program Files\Java\jdk1.8.0_74/bin/java -jar "E:\MonkeyProjects\cubes\Cubes\dist\Cubes.jar"
BasicGameTemplate.jar:
Duplicated project name in import. Project assets-impl defined first in E:\MonkeyProjects\NuWorld\nbproject\assets-impl.xml and again in E:\MonkeyProjects\NuWorldServer\nbproject\assets-impl.xml
Building jar: E:\MonkeyProjects\NuWorldServer\build\assets.jar
BasicGameTemplate.init:
BasicGameTemplate.deps-jar:
Updating property file: E:\MonkeyProjects\NuWorld\build\built-jar.properties
Created dir: E:\MonkeyProjects\NuWorldServer\build\classes
Created dir: E:\MonkeyProjects\NuWorldServer\build\empty
Compiling 7 source files to E:\MonkeyProjects\NuWorldServer\build\classes
warning: [options] bootstrap class path not set in conjunction with -source 1.5
warning: [options] source value 1.5 is obsolete and will be removed in a future release
warning: [options] target value 1.5 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
Note: E:\MonkeyProjects\NuWorldServer\src\NuWorldServer\NuWorldServer.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
4 warnings
BasicGameTemplate.compile:
Created dir: E:\MonkeyProjects\NuWorldServer\dist
Copying 1 file to E:\MonkeyProjects\NuWorldServer\build
Copy libraries to E:\MonkeyProjects\NuWorldServer\dist\lib.
Building jar: E:\MonkeyProjects\NuWorldServer\dist\NuWorldServer.jar
To run this application from the command line without Ant, try:
C:\Program Files\Java\jdk1.8.0_74/bin/java -jar "E:\MonkeyProjects\NuWorldServer\dist\NuWorldServer.jar"
BasicGameTemplate.jar:
Created dir: E:\MonkeyProjects\NuWorld\build\classes
Created dir: E:\MonkeyProjects\NuWorld\build\empty
Compiling 7 source files to E:\MonkeyProjects\NuWorld\build\classes
warning: [options] bootstrap class path not set in conjunction with -source 1.5
warning: [options] source value 1.5 is obsolete and will be removed in a future release
warning: [options] target value 1.5 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
Note: E:\MonkeyProjects\NuWorld\src\NuWorld\StateRunningGame.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
4 warnings
compile:
Created dir: E:\MonkeyProjects\NuWorld\dist
Copying 1 file to E:\MonkeyProjects\NuWorld\build
Copy libraries to E:\MonkeyProjects\NuWorld\dist\lib.
Building jar: E:\MonkeyProjects\NuWorld\dist\NuWorld.jar
To run this application from the command line without Ant, try:
C:\Program Files\Java\jdk1.8.0_74/bin/java -jar "E:\MonkeyProjects\NuWorld\dist\NuWorld.jar"
jar:
BUILD SUCCESSFUL (total time: 9 seconds)

Any Suggestions?

A couple rebuilds later, the problem went away …