Online Training Spring Hibernate Training in Delhi R Programming Training Course Big Data and Hadoop Training Java Training  




Share on Google+Share on Google+

Faisal Ansari
2 Answer(s)      6 years and 5 months ago
Posted in : Java Beginners

How to create .Exe file in jana?

View Answers

February 28, 2011 at 4:17 PM

Java Create exe. file:

import java.util.jar.*;
class OnlyExt implements FilenameFilter{
  String ext;
  public OnlyExt(String ext){
  this.ext="." + ext;
  public boolean accept(File dir,String name){
  return name.endsWith(ext);
public class CreateExe{
public static int buffer = 10240;
protected void create(File exefile, File[] listFiles){
byte b[] = new byte[buffer];
FileOutputStream fout = new FileOutputStream(exefile);
JarOutputStream out = new JarOutputStream(fout, new Manifest());
for(int i = 0; i < listFiles.length; i++){
if(listFiles[i] == null || !listFiles[i].exists()|| listFiles[i].isDirectory())
System.out.println("Adding " + listFiles[i].getName());
JarEntry addFiles = new JarEntry(listFiles[i].getName());

FileInputStream fin = new FileInputStream(listFiles[i]);
int len =, 0, b.length);
if(len <= 0)
out.write(b, 0, len);
System.out.println("Exe File is created successfully.");
} catch (Exception ex){}
public static void main(String[]args){
CreateExe exe=new CreateExe();
FilenameFilter ff = new OnlyExt("class");
File folder = new File("c:/Examples");
File[] files = folder.listFiles(ff);
File file=new File("C:/Examples/Examples.exe");
exe.create(file, files);

February 28, 2011 at 7:48 PM

Sorry sir this program is not working. pl make a simple program.


Related Tutorials/Questions & Answers:
File  How to create .Exe file in jana
file  how can copy the information in the file to the string?   Store file data into String
file  Could anyone please help me to write a code that does the following: Opens a file named MyName.txt, reads the first line from the file and displays it, and then closes the file. Thank you so much
file  how can add the information to the graphic file
file  Hi,what can delet some of the information of the file
file  Hi,how can delet some of the information of the file
File   How to find all files in our local computer using java
FILE  There is a file named Name.txt that contains information related to appliances.I want to read the contents of this file and I used the code... args[]) { try { File file=new File("Name.txt"); FileReader f=new FileReader(file
file  hi i want read special line of file. what am i doing ? I write... read data from file. please help me! void maketree(BtNode root,int i) throws... at the following link: Read specific line from file
EAR file
EAR file   What is the EAR file
File path for jar file
File path for jar file  Hi Experts, I have created one eclipse... jar file of that application, unfortunately it is giving the error that resource not found for the template file. Also I had tried to get that path from user
Convesion of txt file to doc file.??????
Convesion of txt file to doc file.??????  how to convert text file to doc file using java
String file in to word file in java
String file in to word file in java  How to convert a String format notepad file into Ms word file in java
File manipulations
File manipulations  how to read input to a file from console
File manipulations
File manipulations  how to count number of words in a file
File manipulations
File manipulations  how to read the contents from one file and move the contents to another file
EAR file
EAR file   What is the EAR file ?   An EAR file is a standard JAR file with an .ear extension, named from Enterprise ARchive file. A J2EE application with all of its modules is delivered in EAR file
File Operations
File Operations  Please i would like to know if it is possible to read from a file and write to the same file at the same time
WAR file
WAR file  What is a WAR file
File Transfer
File Transfer  How to create a file in server side using java swing
File Upload
File Upload  when i execute the image upload to mysql database it shows an exception that file path cannot be found
deleting file
deleting file   how to delete a file from a folder and its corresponding path in database using a servlet
File Handling
File Handling  how we do file handling of parsed XML code bu DOM in java
String file in to word file in java
String file in to word file in java  how to convert a String format word file into Ms Word file using java? please can anyone of you help me
JSP File
JSP File  Hi, What is JSP File? How to create JSP file? Thanks   Hi, JSP file is simple text file with .jsp extenstion. You can run JSP file on tomcat server. Read more at JSP tutorials section. Thanks
JAR FILE  WHAT IS JAR FILE,EXPLAIN IN DETAIL?   A JAR file... and applications. The Java Archive (JAR) file format enables to bundle multiple files into a single archive file. For more information, visit the following
on file system
on file system  how to maintains record in a file using java and how to create objects to each record.   Hi, Please read Java Write file tutorial. Regards Deepak
File Upload
File Upload  Hi I need script / string in PHP where I uploaded the file in html frontend and it should sent the uploaded file as attachment to my email address
jar file
jar file  steps to create jar file with example
jar file
jar file  jar file where it s used
jar file
jar file  how to create a jar file in java