Share on Google+Share on Google+

Faisal Ansari
2 Answer(s)      6 years and 2 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  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 can add the information to the graphic file
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   How to find all files in our local computer using java
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
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
EAR file
EAR file   What is the EAR file
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
Convesion of txt file to doc file.??????
Convesion of txt file to doc file.??????  how to convert text file to doc file using 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
deleting file
deleting file   how to delete a file from a folder and its corresponding path in database using a servlet
File Upload
File Upload  when i execute the image upload to mysql database it shows an exception that file path cannot be found
File Transfer
File Transfer  How to create a file in server side using java swing
File Handling
File Handling  how we do file handling of parsed XML code bu DOM in java
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
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
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
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
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
class file
class file  How to create class file in jsf easily
FILE CONCEPT  Prompt the user to enter the name of a text file to search for. If the name does not end in a .txt extension, display an error message. Search for this file in the current directory. If the file does not exist print
File handlig
File handlig  File hyandling   Hi Please the click on the following link Java file Handling And read the Articles given in it   Hi Please the click on the following link Java file Handling And read
Java Spring Hibernate Struts Training ClassNotFoundException HttpRequestInterceptor java.lang.noclassdeffounderror: org/apache/http/httprequest noclassdeffounderror: org/apache/http/client/methods/httpurirequest java.lang.NoClassDefFoundError: org/apache/http/client/HttpClient How do I resolve this Java Class not found exception? httpclient java.lang.NoClassDefFoundError Apache Commons ioutils maven dependency Read/Convert an inputStream to a String What is the meaning of Java Platform? Why Java is a platform independent language? What is the benefits of learning Core Java? Which technology should I learn after Java? What is array in java with example? How to Convert ArrayList to Array? How to substring in Java? How to format number in Java? What is instance variable in Java? How to download MySQL JDBC driver? What is Calendar class in Java? Which is the best Java tutorials for beginners? How to rename a file in Java? How to delete file in Java code? How to get day from date in Java using Calendar? How to get day of week in Java? How to calculate Date Difference in Java? How to compare date in Java? How to declare array in Java? How to calculate average of array in Java? What is Array in Java? write a java program to find the summation of all the integers entered on command line Sum of two numbers using command line arguments in Java How to create and use Array in Java? How to pass command line arguments in Java? How to create Applet Hello World? Appending String efficiently in Java How to append String in Java? How to list even numbers between 1 and 100? How to add BigDecimal in Java? What is Abstraction In Java? Which is best Beginners Java Tutorial? What is java.util package? Create list from array in Java Filter collection in Java 8 What is the best way to filter a Java Collection? Easy way to transform Collection to Array? How to convert Collection to Array in Java? What are Basic Java Language Elements? Advanced Java Tutorials in 2017 Java brief history Best Reasons to learn Java


Advertisement null