开发者

converting class file to jar file using c++

开发者 https://www.devze.com 2023-03-06 09:28 出处:网络
Is it possible to convert .class file to .jar file using c++ code? (i.ecan we write a code in 开发者_运维知识库c++ that when executed converts given .class file to .jar file)

Is it possible to convert .class file to .jar file using c++ code?

(i.e can we write a code in 开发者_运维知识库c++ that when executed converts given .class file to .jar file)

If yes,how can i do that?


A .jar file is just ZIP archive containing .class files and possibly a manifest file. (The most important part of the manifest file is the name of the class to run with java -jar.) You can generate a .jar file quite easily in C++ from the .class file, by using a library which can generate ZIP archive files.

If you don't care about the size savings because of compression in the ZIP file, you can easily create an uncompressed ZIP file, even without using a library. The ZIP format is documented e.g. here: http://en.wikipedia.org/wiki/ZIP_%28file_format%29

0

精彩评论

暂无评论...
验证码 换一张
取 消