For a single class - we can work out the version of Java used to compile it:
javap -verbose className
I have a scenario where I need to scale this up to a jar file containing many classes and jar files.
My question is: Is there a way within a bash script to determine the java version required by a jar file containing class files and jar files?
You can extract the JAR file and check the MANIFEST.MF file, which contains information about the JDK used to build the JAR. The "Created-By" or "Build-Jdk" header in the MANIFEST.MF file stores the JDK version used to create the JAR
replace JarName.jar with your jar
here is the bash script to find the jdk version: