{"id":5201,"date":"2012-11-01T22:45:00","date_gmt":"2012-11-01T22:45:00","guid":{"rendered":""},"modified":"2026-04-18T22:46:53","modified_gmt":"2026-04-18T22:46:53","slug":"jython-unpack-the-manifest-file-from-a-jar-on-the-windows-platfom","status":"publish","type":"post","link":"https:\/\/hellem.org\/wblog\/?p=5201","title":{"rendered":"Jython &#8211; Unpack the manifest-file from a jar on the Windows platfom"},"content":{"rendered":"<p>Decided to create a script based on Jython v 2.1 (WebSphere comes with that version) that finds all third party jar-files packed in a EAR-file. When found I also needed to read the MANIFEST.MF-file to figure out the version of the jar. To accomplish this I needed to execute jar.exe to be able to extract the manifest file, when that is done I can read the line <strong>implementation-version<\/strong> in the file.<\/p>\n<p>First, import the needed Java-classes<br \/>\n<!-- codeblock lang=\"Jython\" line=\"1\" --><\/p>\n<pre><code>\r\nimport java.lang.ProcessBuilder as ProcessBuilder\r\nimport java.lang.Process as Process<\/code><\/pre>\n<p><!-- \/codeblock --><\/p>\n<p>Then in the script<br \/>\n<!-- codeblock lang=\"Jython\" line=\"1\" --><\/p>\n<pre><code>\r\npb = ProcessBuilder(['cmd.exe', '\/C', 'd:\/WebSphere\/AppServer\/java\/bin\/jar.exe','xvf', 'd:\/path\/lib', 'META-INF\/MANIFEST.MF']);\r\npb.directory(io.File('d:\/temp'))\r\nprocess = pb.start()\r\nprocess.waitFor()\r\nprocess.destroy()<\/code><\/pre>\n<p><!-- \/codeblock --><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Decided to create a script based on Jython v 2.1 (WebSphere comes with that version) that finds all third party jar-files packed in a EAR-file. When found I also needed to read the MANIFEST.MF-file to figure out the version of the jar. To accomplish this I needed to execute jar.exe to be able to extract [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[47],"tags":[],"class_list":["post-5201","post","type-post","status-publish","format-standard","hentry","category-work-geek"],"_links":{"self":[{"href":"https:\/\/hellem.org\/wblog\/index.php?rest_route=\/wp\/v2\/posts\/5201","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hellem.org\/wblog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hellem.org\/wblog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hellem.org\/wblog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hellem.org\/wblog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5201"}],"version-history":[{"count":1,"href":"https:\/\/hellem.org\/wblog\/index.php?rest_route=\/wp\/v2\/posts\/5201\/revisions"}],"predecessor-version":[{"id":12416,"href":"https:\/\/hellem.org\/wblog\/index.php?rest_route=\/wp\/v2\/posts\/5201\/revisions\/12416"}],"wp:attachment":[{"href":"https:\/\/hellem.org\/wblog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5201"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hellem.org\/wblog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5201"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hellem.org\/wblog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5201"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}