Issue in Converting .zip file to .jar file?

Issue in Converting .zip file to .jar file?

I have a folder called "printpdf.jar". I have changed the .jar to .zip and did some customizations. After which i had "zipped" it again and made as ".jar". Now the final file is displayed in executable icon rather then text editor icon. How do i make it display in text editor icon.

View Answers

April 19, 2011 at 4:55 PM

import java.util.*;
import java.util.jar.*;

public class ConvertZipToJar{
public static void main(String[]args)throws Exception{
byte b[] = new byte[10240];
FileOutputStream fout = new FileOutputStream(new File("C:/TextExamples.jar"));
JarOutputStream out = new JarOutputStream(fout, new Manifest());
ZipFile zf = new ZipFile("C:/");
Enumeration entries = zf.entries();
ZipEntry ze = (ZipEntry) entries.nextElement();
System.out.println("Adding " + ze.getName());
JarEntry addFiles = new JarEntry(ze.getName());
      long size = ze.getSize();
          if (size > 0){
            System.out.println("Length is " + size);
            BufferedReader br = new BufferedReader(new InputStreamReader(zf.getInputStream(ze))); 
            String line;
            while((line = br.readLine()) != null) {

Related Tutorials/Questions & Answers:
Issue in Converting .zip file to .jar file?
Converting Text Files into Bzip File
Converting the text files into bzip file.
Tomcat jar file issue - JSP-Servlet
find jar file name from multiple set of jar files
Converting the text files into gzip file.
Changes in Jar and Zip
ModuleNotFoundError: No module named 'zip-files'
Java JAR Files
sending a zip file to servlet
jar file
jar file
jar file
jar file
quqtion on jar files
Structs jar files
Java file zip
Create a new zip file in ZipArchive.
How to zip a file using javascrip?
convert zip file to byte array
executing a batch file which depends on jar files from a system tray but console should not display.
convert a file .doc to .zip
How to convert multiple files in java to .zip format
How to use JAR file in Java
converting html file into pdf - Struts
Create zip file in Java
Java Util Zip. Zip files/folders inside a folder, without zipping the original source folder.
converting one file format to another
ffmpeg converting file mp4 to mov
zip file upload in php - WebSevices
Read file zip in J2ME - MobileApplications
File path for jar file
jar file - Java Beginners
Java Zip Package
Java Jar File
Unzip a ZIP File
Creating a ZIP file in Java
converting an xml file in relational database objects
ModuleNotFoundError: No module named 'filee'
ModuleNotFoundError: No module named 'filem'
ModuleNotFoundError: No module named 'filez'
Hibernate required jar files - Hibernate
Necessary Jar and War files for struts - Struts
Issue when deploying mdb jar in weblogic
ModuleNotFoundError: No module named 'filex'
ModuleNotFoundError: No module named 'filex'
Zip File Using Java
find zip file length lessthen 5MB
How to extract zip file in java.