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 Mike Lewis 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
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.
 
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:
 
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
 
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:
 
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.
 
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:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top