aspose file tools*
The moose likes Beginning Java and the fly likes xxxx.jar seen as xxxx.zip on desktop and won't run Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "xxxx.jar seen as xxxx.zip on desktop and won Watch "xxxx.jar seen as xxxx.zip on desktop and won New topic
Author

xxxx.jar seen as xxxx.zip on desktop and won't run

Bill Stanard
Greenhorn

Joined: Oct 10, 2005
Posts: 12
Running a .jar file (as an executable) on my machine (where I run JGrasp with the SDK loaded) I have no problem. When I post the .jar on my intranet server and download it to a machine where I have only the JRE installed, it is seen as a .zip file and gives me the error message "Could not find the main class. Program will exit" when I double click it, even after I change the name from xxxx.zip to xxxx.jar.

I think that the manifest file is correct because the .jar runs ok with double-clicking on the "full java" machine. Any suggestions?
Norm Radder
Ranch Hand

Joined: Aug 10, 2005
Posts: 690
    
    1
Open the file with Winzip or some other editor and inspect the manifest file.
Renaming from jar to zip and back shouldn't change the contents of the file.

Have you tried manually entering:
java.exe -jar xxxx.jar

Copy and post the contents of the console with the commandline and the error messages so we can see what's happening.
Bill Stanard
Greenhorn

Joined: Oct 10, 2005
Posts: 12
The (working on my machine) manifest file points at MBSGUI as the file with the main method. I used the following command to execute the MBSimulation.jar file:

java.exe -jar MBSimulation.jar

The error thrown is as follows:

java.lang.UnsupportedClassVersionError: MBSGUI (Unsupported major.minor version 49.0)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
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)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Exception in thread "main"

Does this help?

cheers!
Bill
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

That error means that the class files are newer than the JVM you're trying to run them on. 49.0 is the version that Tiger (Java 5) produces; any earlier JVM (like version 1.4) will print an error message like this and be unable to load the program.

If you're using Tiger features, you can only run on a Tiger JVM. Alternatively, if you're not, you can compile with the "-source 1.4" command line arguments to javac to produce backward-compatible class files.


[Jess in Action][AskingGoodQuestions]
Bill Stanard
Greenhorn

Joined: Oct 10, 2005
Posts: 12
Thank you, folks, both for listening and giving such good advice. Updated the JRE to 1.5 (or is it 5.0?) and all ran beautifully. Had to change the file name from xxxx.zip to xxxx.jar, but that is small cheese. Again, thanks...
cheers!
Bill
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: xxxx.jar seen as xxxx.zip on desktop and won't run