Find the compiled class version number

My project consists of some third-party jar files that were compiled in another version of java. My project uses an old version of java, so I get it UnsupportedClassVersionErrorat runtime. Is there any other way to get the version java/jre number[45..51]in which the class files are compiled so that I can check the jar files before using it.

+4
source share
1 answer

You can use javap(with -vfor verbose mode) and specify any class from the jar file. For example, looking at the Jord Time jar file:

javap -cp joda-time-2.7.jar -v org.joda.time.LocalDate

-cp jar, , -v , , jar.

:

Classfile jar:file:/c:/Users/Jon/Test/joda-time-2.7.jar!/org/joda/time/LocalDate.class
  Last modified 12-Jan-2015; size 16535 bytes
  MD5 checksum d19ebb51bc5eabecbf225945eccd23ef
  Compiled from "LocalDate.java"
public final class org.joda.time.LocalDate extends org.joda.time.base.BaseLocal implements org.joda.time.ReadablePartial,java.io.Serializable
  minor version: 0
  major version: 49

" " " " - , .

, jar , , .

+8

Source: https://habr.com/ru/post/1613519/


All Articles