I have a website that has been operating for many years (2). But since the new Java restrictions (January 2014), my applet is blocked. Therefore, after some reading, it seems that all I need is to modify the manifest file; I donโt even need to recompile the code. (If I am wrong about this, please correct me.)
So, I created the following manifest file
Manifest-Version: 1.0 Created-By: 1.7.0_51 Permissions: sandbox Application-Name: MyFarmingBusiness Application-Library-Allowable-Codebase:http://mycompany.com/version_4/myapplet/ Caller-Allowable-Codebase:www.mycompany.com Codebase: www.mycompany.com
Then, to enter the manifest in my jar
- I save the manifest.txt file in the same directory as jar
- then in mac osx terminal i type: jar cfm MyGreat.jar manifest.txt
As a result, I get the following error
java.io.IOException: invalid header field at java.util.jar.Attributes.read(Attributes.java:410) at java.util.jar.Manifest.read(Manifest.java:199) at java.util.jar.Manifest.<init>(Manifest.java:69) at sun.tools.jar.Main.run(Main.java:172) at sun.tools.jar.Main.main(Main.java:1177)
Does anyone know how to fix this?
Another approach may be to recreate the jar again. So I did the following
- to extract source:
jar xf MyGreat.jar - but then, I havenโt done this for so long, I donโt know how to restore the jar from the source: the source contains only
.class files in the com/mycompany/... directory, and the manifest in the directory called META-INF . I am trying to do a search on the Internet, but I'm not very lucky how to do this from the terminal.
So maybe someone can tell me how to create a jar with a manifest from the terminal. I know the command: jar cvf MyGreat.jar MyGreat
But how do I get a manifest? where I put the manifest regarding .class files so that in the end I get a jar file with directories: com and META-INF
java jar manifest applet
learner
source share