Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to check the version of jar file?

I am currently working on a J2ME polish application, just enhancing it. I am finding difficulties to get the exact version of the jar file. Is there any way to find the version of the jar file for the imports done in the class? I mean if you have some thing, import x.y.z; can we know the version of the jar x.y package belongs to?

like image 341
Ritesh Mengji Avatar asked Apr 29 '11 16:04

Ritesh Mengji


People also ask

What is a jar version?

JAR file is a file format based on the popular ZIP file format and is used for aggregating many files into one. A JAR file is essentially a zip file that contains an optional META-INF directory.

Can you check the code of JAR file?

Jar files are archive files that contains of a lot of different java classes (files). You can use winzip/winrar to open the jar files and you can see those java classes in jar files. Typically you can use a Java decompiler to decompile the class file and look into the source code.


2 Answers

Decompress the JAR file and look for the manifest file (META-INF\MANIFEST.MF). The manifest file of JAR file might contain a version number (but not always a version is specified).

like image 120
Vivek Avatar answered Sep 29 '22 13:09

Vivek


You need to unzip it and check its META-INF/MANIFEST.MF file, e.g.

unzip -p file.jar | head 

or more specific:

unzip -p file.jar META-INF/MANIFEST.MF 
like image 26
kenorb Avatar answered Sep 29 '22 14:09

kenorb