INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Opening a ".jar" File - Exception Error

Opening a ".jar" File - Exception Error

(OP)
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.  

RE: Opening a ".jar" File - Exception Error

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

RE: Opening a ".jar" File - Exception Error

(OP)
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?

RE: Opening a ".jar" File - Exception Error

Is there any chance or recompiling the code?

Cheers,
Dian

RE: Opening a ".jar" File - Exception Error

(OP)
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.

RE: Opening a ".jar" File - Exception Error

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: http://home.arcor.de/hirnstrom/minis/index.html

RE: Opening a ".jar" File - Exception Error

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

RE: Opening a ".jar" File - Exception Error

(OP)
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. smile 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.

RE: Opening a ".jar" File - Exception Error

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

RE: Opening a ".jar" File - Exception Error

(OP)
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. sad

I presume it's because it was compiled with 16021?

RE: Opening a ".jar" File - Exception Error

It's just for one user?  

Cheers,
Dian

RE: Opening a ".jar" File - Exception Error

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.

RE: Opening a ".jar" File - Exception Error

(OP)
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.

RE: Opening a ".jar" File - Exception Error

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

RE: Opening a ".jar" File - Exception Error

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: http://home.arcor.de/hirnstrom/minis/index.html

RE: Opening a ".jar" File - Exception Error

Quote:

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.

RE: Opening a ".jar" File - Exception Error

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.
 

RE: Opening a ".jar" File - Exception Error

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: http://home.arcor.de/hirnstrom/minis/index.html

RE: Opening a ".jar" File - Exception Error

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

RE: Opening a ".jar" File - Exception Error

Well, Diancecht, I respect you for a lot of helpful hints here, but:
"Or progamos using reserved word as variable names (enum)" wont hurt for a compiled program. If you liked to recompile it for 1.6, then you have to do something. Else it would run, I guess, on 1.6 without problems.
I'm not 100% sure, but we still stand in anecdotal land.

My claim is: If you have a compiled program which runs on java-1.3 it will run on java-1.6.

Of course, if you support a program, which was initially written for 1.3, you will have to do some migration work, because of such reserved words for example, or to get rid of warnings (frame.show () => frame.setVisible (true);)

You need the support from sun and bugfixes and like to enhance your program, so you want to compile it against some recent JVM, and **THEN** you have to fix some parts.

But not in the bytecode. Prove me wrong.

don't visit my homepage: http://home.arcor.de/hirnstrom/minis/index.html

RE: Opening a ".jar" File - Exception Error

Stefan,

I'm very proud of your respect.

You're right, I think: the program with "enum" will run without problems. I was just trying to mention migration problems you can face when upgrading JDK, what usually involved refactoring code.

I will mention another one: since 1.3, many packages have been included in JDK. Some of them are extensios that were out of JDK at the beginning (XML processing) so that can be another source of problems.

Or the use of unsuppported packages like com.sun

 

Cheers,
Dian

RE: Opening a ".jar" File - Exception Error

My claim still is: If you have a compiled program which runs on java-1.3 it will run on java-1.6.

You say I would need to change the classpath in a shell script which launches the jar/ the Java-program from the jar?

If it isn't just a CLASSPATH issue, I would like to receive such a jar or such a class.  

don't visit my homepage: http://home.arcor.de/hirnstrom/minis/index.html

RE: Opening a ".jar" File - Exception Error

Quote:

My claim still is: If you have a compiled program which runs on java-1.3 it will run on java-1.6.

Almost true, but as said before by Dian, missing/removed libraries can be a problem.
We had a conversion-source with these imports:

CODE

import com.sun.tools.javac.v8.util.*;
import com.sun.tools.javac.v8.code.*;
import com.sun.tools.javac.v8.tree.*;
import com.sun.tools.javac.v8.parser.*;
import com.sun.tools.javac.v8.comp.*;
import com.sun.tools.javac.v8.code.Symbol.*;
import com.sun.tools.javac.v8.tree.Tree.*;

and this will only compile in 1.3, and not in any of the newer Java versions, but it also won't run on the newer platforms, as the v8 was (probably) an unsupported package.

RE: Opening a ".jar" File - Exception Error

Well it was always noted, that this package wouldn't be supported, afaik you weren't even allowed to ship it with the JRE and it didn't came with the JRE.

I don't know what happens if you use it as jar with a recent JVM.

If you still have a 1.3 Java, read the License agreement.  

don't visit my homepage: http://home.arcor.de/hirnstrom/minis/index.html

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close