运行 一个带有不同 java 版本的依赖 jar 的 jar

Running a jar with depedency jar at a different java version

我的项目是 运行 java 7 而我的一个依赖 jar 是根据其清单文件使用 java 8 构建的。我想 运行 我的项目以 java 1.7 依赖项的 jar 形式!是否可以将依赖 jar 的 java 版本更改为从 1.8 到 1.7 的较低版本?

这看起来真是个糟糕的主意。

你很可能会遇到UnsupportedClassVersionError :

Class UnsupportedClassVersionError

public class UnsupportedClassVersionError
extends ClassFormatError

Thrown when the Java Virtual Machine attempts to read a class file and determines that the major and minor version numbers in the file are not supported.