A simple rotation application. The jar file works on my computer but not others

This is my first question, so I apologize for any mistakes. I will try to provide all the information I can. I basically wrote a simple swing application that just uploads an image to JPanel and displays it. I am using Netbeans 7.1 and I have the latest version of the Java SDK. Anyway, I used the "Build" feature in NetBeans 7.1 to deploy my application in a Jar file. When I double-click the Jar file on my PC, it works without problems. However, when I put it on other computers (I tested 2 more others, as with the current JRE itself), it does not open, citing the following error:

could not find main class: swong.Startup. Program will exit

swong is my package name, and Startup is my main method. I checked the manifest file that is created using the Netbeans assembly, and it [manifest] really contains the location of my main class of methods.

From the search, I ran into similar problems in which the class path is set incorrectly, but I do not understand how this can cause my specific error.

If someone could help me, I would be on the moon. I have been learning java for a year or so, and I have a good pen, but I NEVER could make a Jar that runs on a computer that was not my own. So, 10 points and thanks in advance.

jo.

EDIT: Thanks for the answers. I am doing shift work and lying around, but tomorrow I will check and shout out these answers and provide additional information. Thanks again. ho

+3
3

. 1 , "java -jar AppName.jar" . , , - JRE exe (: jre_1.7.0) . (install.bat),

jre_1.7.0 → jre

set path = "C\Program Files\Java\jre_1.7.0\bin"

java -jar yourAppName.jar

JRE, JRE. , JRE bin "java -jar". , , JRE, jar java-jar.

+2

, jar ( )

jarfile.jar
  |---------- swong
                |---------- Startup.class
  |---------- META-INF
                |---------- MANIFEST.MF

, "Startup" . , .java, .

+2

java7, java7 Java Runtime Environment, java7. , .jar Java7 ? , JRE, , .

To check which environment is enabled, you can check the following value in your registry: HKEY_CLASSES_ROOT \ jarfile shell \ open \ command \

this should point to your last JRE. Or, if you want to remain compatible with java6, determine the appropriate compilation level in your build environment.

0
source

All Articles