I have a .jar generated by Eclipse, which I cannot run on other computer (with Windows XP). The “Could not find the main class. Program will exit” message appears. That computer runs fine another .jar generated by Netbeans, so it is not a problem with JRE, I guess. I updated JRE but it changed nothing. What is the problem?
UPDATE: I forgot to mention, that I made a runnable jar file. On two another computers it works fine (win 7 and XP), but on that specific one not.
UPDATE 2: It’s a Swing application, so the JAR is run by double-clicking.
Check the contents of the manifest. The
Main-Class: foo.Barline must correspond to an /foo/Bar.class entry in the jar file, andfoo.Bar.javamust contain an appropriate main-method. Also all jars reference in theClass-Path:line must be copied too.Use “jar tvf my.jar” to see the layout.