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?
Click the Libraries tab in this dialog, click Add External JARs for . jar files or Add Class Folder for . class files, navigate to the . jar file or to the folder containing .
Open the Jar File wizard In the Package Explorer select the items that you want to export. If you want to export all the classes and resources in the project just select the project. Click on the File menu and select Export. In the filter text box of the first page of the export wizard type in JAR.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With