Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening a ".jar" File - Exception Error

Status
Not open for further replies.

mukker

IS-IT--Management
Jan 25, 2005
23
0
0
GB
Please go easy with me guys. I'll do my best to explain and i'm not even sure this is the right forum - shows how much i know. If any of you clever people have a solution i'd really appreciate it in laymen terms.

I have a user who is trying to open a .jar file and receives this error:

"Exception in thread "main" java.lang.UnsupportedClassVersionError:
U nsupported major.minor version 49.0) at java.lang"

After a bit of googling i've found that it's to do with it being compiled in a higher version than the user has on their workstation? I've tried right clicking the ".jar" file and opening it with another version of Java but still get the same error. I believe this can be resolved but no idea at the moment and would really appreciate some help.
 
Open the file as a zip file, look for a file called manifest.mf and if it exists, take a look at what info is shown about versions.

Cheers,
Dian
 
Here you go

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.8.1
Created-By: 1.6.0_21-b06 (Sun Microsystems Inc.)
Main-Class: decrypter.DecrypterApp
Class-Path: lib/appframework-1.0.3.jar lib/swing-worker-1.1.jar
X-COMMENT: Main-Class will be added automatically by build

The Java version on the workstations is 1.3?
 
Not sure that there is?

Is there no way round this other than recompiling to an older version.

Thanks for your time on this Diancecht.
 
Better: get rid of Java 1.3 on that workstation, which is over 10 years old, maybe from the last millenium and slow, and get a recent one, which is 1.6.

Trying to recompile recent code will fail with very high probability. Spare that time.

don't visit my homepage:
 
Unless there's a reason to keep the old Java version. If it's a corporate environment, migrating is not always an option.

Cheers,
Dian
 
Eck i'm confused now.

When i got to MS DOS and type Java -Version it comes up with Java Version 1.3?

I've just done a search on the C: drive of my machine (all machines are the same) for Java and a load of different files have come up?

One of them is a javacpl.exe 1.6.0_02, so being a curious soul i double clicked it and it opened the Java Control Panel. :) I clicked on the "general" tab, selected "about" and it says: Java Platform Standard Edition 6, Version 1.60 Build 02b06.

Is this going to help me in any way? Sorry if i'm not explaining very well as this is all new to me.
 
I take you're on Windows so you can go to Add or Remove programs and see how many versions of Java you have installed.

Another way would be a search just for java.exe.

If you want to associate jar files with a newer version you have installed, you can right click the jar, open with, Choose program, then navigate the the directory where java.exe is a select it with the "Always use this program" checked.

Cheers,
Dian
 
Dian,

There are 6 versions of Java.exe, they are as follows:

13002
13124
14204
15005
15011
16002

Tried opening with every java.exe and javaw.exe, but no joy. :-(

I presume it's because it was compiled with 16021?
 
You'd create a batchfile that corrects the path and java_home environment settings to point to java 6, that also starts the .jar, and use that to start the app. Don't change the system-defaults without researching the impact on other apps, as lots of java 1.3 apps don't run (well) on newer java versions.
 
It is for 4/5 users. I was just hoping there would be a simple workaround...maybe not.

I don't want to change anything that is going to affect applications that run on the current/installed version. Wouldn't know where to start in creating a batch file and changing environment settings??

Again guys, thanks so much for your time on this.
 
The bacth file would be just a .bat file you can create with notepad with a single line

c:\path_to_recent_Java_version\java.exe -jar c:\path_to_the_jar_file\jar_file_name.jar

More info here

Cheers,
Dian
 
The oldest java which is still supported is, afaik, 1.4.2.

I would move the older versions to a place where they aren't found autmatically, test whether the old programs still work, and if yes, throw the old ones out.

@TonHu: Can you name such a program which doesn't run well with 1.6 but 1.3/1.4 or 1.5? I once saw such a program, which was just crap - it tested for versions 1.1, 1.2 and 1.3 and reported for an version 1.4: too old! The programmer-hero coulnd't imagine that there would be a newer JVM in the future. The only reason it didn't work was his silly test.

In general, you better leave software without actual support. Of course you might have an exception.

I never saw a program which didn't run on never VMs.

@mukker: MS-DOS is out of lifetime for a long time. You mean cmd.exe or something like that?

don't visit my homepage:
 
Can you name such a program which doesn't run well with 1.6 but 1.3/1.4 or 1.5? I once saw such a program, which was just crap - it tested for versions 1.1, 1.2 and 1.3 and reported for an version 1.4: too old! The programmer-hero coulnd't imagine that there would be a newer JVM in the future. The only reason it didn't work was his silly test.
No, but I know of software written in 1.3 that uses a (java) parser (or something like it, didn't work with it), no longer available in newer versions.
 
I know there are some IBM applications (IT specific, but I don't remember their name right now) that don't run with java 1.5 nor 1.6, but I don't know if they run with Java 1.4.
 
You don't know a name, don't know the version, what do you know?

IBM isn't able to support a useful application? Come on!

I like to see a downloadable example which I can test myself. A lot of the users here don't know the difference between Java and JavaScript.

don't visit my homepage:
 
In the past, I worked on migration projects to Java 1.4 from prior versions. For example, focus management was a common issue.

And when dealing with application servers or corporate environments, Java software depending on thir party extensions (like XML parsers at the beginning) need to be refactored.

Or progamos using reserved word as variable names (enum)

So Stefan, backwards compatibility is a matter of percentage, there's always an open door to doom

Cheers,
Dian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top