Latest Tutorials| Questions and Answers|Ask Questions?|Site Map




Have Programming Question? Ask it here!
 
 
 


faith kay
convertion
1 Answer(s)      2 years and 4 months ago
Posted in : Java Beginners


how to convert java class to executable file


Advertisement
View Answers

April 25, 2012 at 3:42 PM


import java.io.*;
import java.util.zip.*;

public class CreateZip {
public static int buffer = 10240;
protected void createZipArchive(File zipFile, File[] listFiles) {
try {
byte b[] = new byte[buffer];
FileOutputStream fout = new FileOutputStream(zipFile);
ZipOutputStream out = new ZipOutputStream(fout, new Manifest());
for (int i = 0; i < listFiles.length; i++) {
if (listFiles[i] == null || !listFiles[i].exists()|| listFiles[i].isDirectory())
System.out.println("-----------------------------------");
System.out.println("Adding " + listFiles[i].getName());
ZipEntry addFiles = new ZipEntry(listFiles[i].getName());
addFiles.setTime(listFiles[i].lastModified());
out.putNextEntry(addFiles);

FileInputStream fin = new FileInputStream(listFiles[i]);
while (true) {
int len = fin.read(b, 0, b.length);
if (len <= 0)
break;
out.write(b, 0, len);
}
fin.close();
}
out.close();
fout.close();
System.out.println("Exe File is created successfully.");
} catch (Exception ex) {}
}
public static void main(String[]args){
CreateZip jar=new CreateZip();
File folder = new File("c://Examples");
File[] files = folder.listFiles();
File file=new File("C://Examples//Application.exe");
jar.createZipArchive(file, files);
}

}


Related Tutorials/Questions & Answers:
Advertisements
convertion before downloading
convertion before downloading  convert zip file which is in server to doc while before downloading
convertion of string entered in the web interface
convertion of string entered in the web interface  hi i am entering some values in the textbox of web interface.how i can access that values and convert to particular type.in short how to link web interface values with my java
hex to binary convertion in java - Java Beginners
hex to binary convertion in java  HI, im doin a application wch requires to send a binary message to other mobiles, so i need to convert the hex values to binary format.So the binary format could either be a ringtone
hex to binary convertion in java - Java Beginners
hex to binary convertion in java  HI, im doin a application wch requires to send a binary message to other mobiles, so i need to convert the hex values to binary format.So the binary format could either be a ringtone
hex to binary convertion in java - Java Beginners
hex to binary convertion in java  HI, im doin a application wch requires to send a binary message to other mobiles, so i need to convert the hex values to binary format.So the binary format could either be a ringtone
Convert Text To PDF
Convert Text To PDF       Here we are discussing the convertion of a text file into a pdf file by using an example. In this example we take a string  from console, pass
sahabaj
sahabaj  sir i have send u a question relating to convertion of number to words.i want to know the algorithm and variable description of the program
datatype - Java Beginners
datatype  how i convert char datatype in string format for ex.(convertion of int datatype) int variable_name=Integer.parseInt(br.readLine());  Hi Friend, Try the following code: import java.io.*; public class
servlet filters
convertion , data compression etc. The filters contain the url like /*. ex
 

 

 

DMCA.com