User Tools

Site Tools


documents:120329javatips

This is an old revision of the document!


Java Tips

This page is a none-organized list of tips, mostly for the errors I encountered with Java programming and the trouble shooting.

Unsupported major.minor version 51.0

During compilation of Java program, I encountered this error message. The reason was pretty straight forward: when the program that is being compiled is referring to a library or jar file that was compiled using different JRE version, this message appears.

To overcome this error, simple re-compile all the jar files by a consistent JRE version.

java.lang.SecurityException – signer information does not match signer information of other classes in the same package

I encountered this message when there is a conflict by having two same jar files in the class path. Removing one of them should over come this error. There seems to be more to it as an explanation, and for that refer to this page or the quote below. This happens when classes belonging to the same package are loaded from different JAR files, and those JAR files have signatures signed with different certificates - or, perhaps more often, at least one is signed and one or more others are not (which includes classes loaded from directories since those AFAIK cannot be signed). So either make sure all JARs (or at least those which contain classes from the same packages) are signed using the same certificate, or remove the signatures from the manifest of JAR files with overlapping packages.

Extract compiler version from a class file

Sometimes you want to know the version of Java compiler used for a certain class. Then do the following.

javap -verbose MyClass

There will be then a line “major version XX” at the beginning of the output. Below is the list of correspondence between Java version and “major version”. Java 1.2 uses major version 46 Java 1.3 uses major version 47 Java 1.4 uses major version 48 Java 5 uses major version 49 Java 6 uses major version 50 Java 7 uses major version 51

documents/120329javatips.1334328258.txt.gz · Last modified: 2016/05/24 12:46 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki