Results 1 to 5 of 5
- 06-25-2010, 08:20 AM #1
Member
- Join Date
- Jun 2010
- Posts
- 7
- Rep Power
- 0
How to create an exe file in java
Hi I want to create an exe file for my java app.
I tried with some third party softwares JEXECreator, successfully created the exe file and its working fine in my system, when I tried with another machine, it’s not working. I got the following error
* The error occurred while running the application. The exit code is 0x10000223.
* Contact the vendor of the application for troubleshooting.
java.lang.ClassNotFoundException: com.sample.SampleMain
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at com.ucware.JEXEClassLoader.run(Unknown Source)
at com.ucware.JEXEClassLoader.main(Unknown Source)
**************************************
I know there is something wrong with the classpath which I set.
Actually I want to create the exe file myself without using any third party software.
I found the steps in lot of sites
Created the manifest file named Sample.mft with following contents
Manifest-Version: 1.0
Main-Class:
Class-path:
In this I have some doubts,
1. How the Main-Class should be added, with the full package name (com.sample.SampleMain) or the class name alone (SampleMain) or with the extension (SampleMain.class)
2. How the class-path should be added, I have 4 java classes and 2 jars in my project. How to add all these in the class path, and do I need to add the java jdk in classpath.
3. Where the manifest file should be saved
4. What should be the manifest file extension (mf or mft)
5. In command prompt from which directory I should create the exe file (from my project folder or src folder or the folder which contains all the java classes)
6. What’s the syntax should be used while creating jar in command prompt
(jar cmf Sample.mf Sample.jar Sample1.class Sample2.class Sample3.class Sample4.class jar1.jar jar2.jar) like this or (jar cvfm Sample.jar sample.mf *.class)
When I did something like this I am getting a jar instead of exe file, When I run the jar in command prompt using "java -jar sample.jar" then I am getting class not found exception".
Actually how to create an exe file instead of jar file, that means just by double clicking that exe file, should run my app in any machine.
Can anyone help me to do this?
Thanks in advance.
- 06-25-2010, 08:30 AM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 14,422
- Blog Entries
- 7
- Rep Power
- 29
You normally don't generate executable .exe files from Java source directly; you generate .class files which, when they start being interpreted, are further compiled to machine code by the JIT compiler. Study .jar files and their generation instead.
kind regards,
Jos
- 06-25-2010, 09:49 AM #3
Moderator
- Join Date
- Apr 2009
- Posts
- 13,541
- Rep Power
- 27
An executable jar will run on a double click. As Jos says, go through the jar tutorial. Making an exe sort of defeats one of the points about Java.
- 07-09-2010, 03:28 PM #4
Senior Member
- Join Date
- Apr 2010
- Location
- Dhaka,Bangladesh
- Posts
- 180
- Rep Power
- 0
If your JAR file doesn't run on double click,then go to
Windows window->tools->Folder option->File types->
select jar executable jar file->Edit->
make sure that here is written "C:/Program Files/Java/Jdk/bin/javaw.exe" -jar "%1"%* "beside the BROWSE.
- 07-09-2010, 05:20 PM #5
Similar Threads
-
create the tar.gz file for UNIX plateform in java
By ashu_knw in forum New To JavaReplies: 3Last Post: 04-16-2010, 11:22 AM -
Create an executeable file for java
By cowboy in forum New To JavaReplies: 14Last Post: 11-03-2009, 11:30 PM -
How do i create a help file in java for the users of my application
By Manfizy in forum New To JavaReplies: 5Last Post: 08-25-2009, 08:43 AM -
How to create exe file in java
By radix in forum New To JavaReplies: 8Last Post: 11-06-2008, 04:17 PM -
can java.io.File create a list of all files and folders.
By MattStone in forum New To JavaReplies: 20Last Post: 12-17-2007, 03:20 PM
Bookmarks