{"id":175,"date":"2011-03-23T06:57:58","date_gmt":"2011-03-23T10:57:58","guid":{"rendered":"http:\/\/joshho.com\/?p=175"},"modified":"2011-03-23T06:57:58","modified_gmt":"2011-03-23T10:57:58","slug":"playing-with-jars","status":"publish","type":"post","link":"https:\/\/www.joshho.com\/blog\/2011\/03\/23\/playing-with-jars\/","title":{"rendered":"Playing with Jars"},"content":{"rendered":"<p>Recently, I came across a problem when updating a jar file.<br \/>\nHow does one update a jar file with a class file using a particular packaging?<\/p>\n<p>So you have a jar file named <code>foo.jar<\/code> with two elements in it, a package (<code>fooPackage<\/code>) containing multiple class files and your manifest.<br \/>\nYou also have\u00a0a class named <code>bar.class<\/code> that is packaged by <code>fooPackage (<\/code>*see bottom).<br \/>\nDo you think this will package it correctly?<\/p>\n<p><code>&gt;&gt; jar uf foo.jar bar.class<\/code><\/p>\n<p>No. Not really. It adds <code>bar.class<\/code> to <code>foo.jar<\/code> without a hitch, but does not keep your packaging path.\u00a0Instead, it adds <code>bar.class<\/code> to <code>foo.jar<\/code>, but outside the package path you want.<br \/>\nIf this was a stand-alone java application, this will not reflect your changes when running.<\/p>\n<p>With this being said, I turned to a few external solutions to solve this problem.<br \/>\nAfter hours of\u00a0frustration with a few programs (ie: DJ Java Decompiler), I finally ended up using WinRAR that did the trick and placed the <code>bar.class<\/code> in the correct package path (graphically).<\/p>\n<p>*Note: When I say packaged by <code>fooPackage<\/code> I mean that the .java equivalent of <code>bar.class<\/code> has the code:\u00a0<code>package fooPackage;<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Recently, I came across a problem when updating a jar file.<br \/>\nHow does one update a jar file with a class file using a particular packaging?<\/p>\n<p>So you have a jar file named <code>foo.jar<\/code> with two elements in it, a package (<code>fooPackage<\/code>) containing multiple class files and your manifest.<br \/>\nYou also have\u00a0a class named <code>bar.class<\/code> that is packaged by <code>fooPackage (<\/code>*see bottom).<br \/>\nDo you think this will package it correctly?<\/p>\n<p><code>&gt;&gt; jar uf foo.jar bar.class<\/code><\/p>\n<p>No. Not really. It adds <code>bar.class<\/code> to <code>foo.jar<\/code> without a hitch, but does not keep your packaging path.\u00a0Instead, it adds <code>bar.class<\/code> to <code>foo.jar<\/code>, but outside the package path you want.<br \/>\nIf this was a stand-alone java application, this will not reflect your changes when running.<\/p>\n<p>With this being said, I turned to a few external solutions to solve this problem.<br \/>\nAfter hours of\u00a0frustration with a few programs (ie: DJ Java Decompiler), I finally ended up using WinRAR that did the trick and placed the <code>bar.class<\/code> in the correct package path (graphically).<\/p>\n<p>*Note: When I say packaged by <code>fooPackage<\/code> I mean that the .java equivalent of <code>bar.class<\/code> has the code:\u00a0<code>package fooPackage;<\/code><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[27],"tags":[43,45,44,42,36,28,38,39,37,40,41],"_links":{"self":[{"href":"https:\/\/www.joshho.com\/blog\/wp-json\/wp\/v2\/posts\/175"}],"collection":[{"href":"https:\/\/www.joshho.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.joshho.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.joshho.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.joshho.com\/blog\/wp-json\/wp\/v2\/comments?post=175"}],"version-history":[{"count":0,"href":"https:\/\/www.joshho.com\/blog\/wp-json\/wp\/v2\/posts\/175\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.joshho.com\/blog\/wp-json\/wp\/v2\/media?parent=175"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.joshho.com\/blog\/wp-json\/wp\/v2\/categories?post=175"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.joshho.com\/blog\/wp-json\/wp\/v2\/tags?post=175"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}