Share on Google+Share on Google+

Convert Zip To EXE

In this example we are going to convert a zipped file into exe.

Convert Zip To EXE


In this example we are going to convert a zipped file into exe.

To convert a Zip file into .exe file pass the name of a zip file using command line arguments. Use FileInputStream  to take the zipped file as input. Read the file from the system, unzip the file and store the data of this file into a byte array. Create another file with .exe extension. Write the byte formatted data of the unzip file into .exe file.  

Create FileOutputStream object pass the name of file with .exe extension for creating an exe file. ZipInputStream allows modification on zipped (or unzipped) file. Use getNextEntry() method to set the entry point of the zip file. Create an array of bytes which stores the data of unzipped file and finally write the data into exe file.

Here is the code of the program :

import java.awt.*;
import com.lowagie.text.*;
import com.lowagie.text.pdf.*;
public class  ZipToEXE

public static void main(String arg[])throws Exception
  OutputStream out=new FileOutputStream
  ZipInputStream  zip = new ZipInputStream
new BufferedInputStream(new FileInputStream(arg[0])));
  ZipEntry entry;
  while((entry = zip.getNextEntry()) != null)
  byte data[]=new byte[1024];
  int count;

Download this example.



Posted on: March 14, 2008 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Discuss: Convert Zip To EXE  

Post your Comment

Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
April 25, 2011

sorry sir, wich converter? type: software file to convert a exe or aplication file. i have gone to the website, but no discurtion/ also haven't problem solve. so this website asking to you, please help me.
September 6, 2011
nokia application

file name .zip file nokia zip file could not install mobile phone how can install
September 20, 2011
convert zip into .exe

October 21, 2011

Binod Samantaray
April 19, 2012
zip folder convert to excel

pl. change this file
December 29, 2012
zip to exe games

my question is my pc is one game zip file this game not running in pc show in error is cannot excute exe how to solve this programe
Java Guy
November 12, 2012
this has no chance of ever working

This simply creates a zip file and names it "pdfFile.exe". There is no attempt to make it a valid EXE file. Very silly.