1

I'm runnig debian buster and have a realy old java game that I played native with openjdk but I can not remember the exact version. So i tried to find out with javap with which java version the jar file is compiled.

javap -v java-spiele/edna_bricht_aus/Edna.jar 
Error: class not found: java-spiele/edna_bricht_aus/Edna.jar

default java version is

java -version
openjdk version "11.0.13" 2021-10-19
OpenJDK Runtime Environment (build 11.0.13+8-post-Debian-1deb10u1)
OpenJDK 64-Bit Server VM (build 11.0.13+8-post-Debian-1deb10u1, mixed mode, sharing)

Maybe to new. so I installed openjdk-8 from stretch repo (yes I know franken debian) another try

/usr/lib/jvm/java-1.8.0-openjdk-amd64/bin/javap -v /home/alex/java-spiele/edna_bricht_aus/Edna.jar 
Error: class not found: /home/alex/java-spiele/edna_bricht_aus/Edna.jar

Is it even possible to get information from a commercial game? with openjdk-8 the game is not running it crashes.

2 Answers 2

4

javap expects a class, not a JAR. To disassemble a class in a JAR, add the JAR to the classpath and specify the class name; for example, using JSTL instead of your game:

javap -v -classpath jstl-1.2.jar org.apache.taglibs.standard.tlv.JstlCoreTLV

To see the classes in a JAR, use jar tf; replace slashes with dots to convert a path to a package.

To figure out the versions of Java for which all the classes in a JAR were built, you might be better off extracting the classes in the JAR and running file on them:

mkdir foo
cd foo
jar xf ../java-spiele/edna_bricht_aus/Edna.jar
find . -name \*.class -exec file {} +
2
  • 1
    thank you java 1.6 no gaming session for me.
    – nobody
    Dec 26, 2021 at 13:45
  • javap -v does tell you classfile version, along with a lot of other stuff. Nit: given jar tf change slashes to dots and remove .class to get classname. Dec 27, 2021 at 0:14
1

you can also specify the URL for a class in the jar to javap like this:

javap -v jar:file:///path/to/MyJar.jar!/mypkg/MyClass.class

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .