java - Generating a JAR Manifest -


i need generate manifest jar file (in code) containing following permissions:

permissions: all-permissions 

so far i've gotten far:

    manifest manifest = new manifest();     attributes global = manifest.getmainattributes();     global.put(new attributes.name("permissions"), "all-permissions");     file jarloader = new file("test.jar");     outputstream os = new fileoutputstream(jarloader);     jaroutputstream jos = new jaroutputstream(os, manifest);     jos.close(); 

however erases contents of jar file, creates manifest, , manifest blank. don't understand i'm doing wrong after reading information on , point me in correct direction.

in understanding (i'm no expert) should open jarinputstream jar file have , iterate on jarentry's (like here: jarinputstreamexample). every entry not belong "manifest.mf" pass directly next jaroutputstream (you have 1 of available, right?). jarentry belonging current jar's manifest.mf replace own version , done!

sorry not beeing more specific.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -