| | |
How to convert .class file to .exe file in windows
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
You don't, you create executable jar files (not "exe"s).
http://java.sun.com/docs/books/tutor...jar/index.html
Edit: And, if you want a "real exe" (i.e. a native executable), then use a language designed to produce a native executable (which Java is not).
If you insist on doing something that will negate all the "advantages" gained by using Java and produce a native executable with it, then Google for some thrid party tools that are designed to do this (there are plenty of them). It is not a recommended course of action, though, so your on your own.
http://java.sun.com/docs/books/tutor...jar/index.html
Edit: And, if you want a "real exe" (i.e. a native executable), then use a language designed to produce a native executable (which Java is not).
If you insist on doing something that will negate all the "advantages" gained by using Java and produce a native executable with it, then Google for some thrid party tools that are designed to do this (there are plenty of them). It is not a recommended course of action, though, so your on your own.
Last edited by masijade; Nov 27th, 2008 at 8:52 am.
Java Programmer and Sun Systems Administrator
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
I had a customer once who wanted .exe files instead of .jar files *sigh* guess how happy he was when he found out his program didn't work so well in Linux 
anyhow, an easy-to-use tool to create an .exe from your .jar is NativeJ, an even easier approach to your question would be the search function, since this question has been asked (and answered) a lot of times before.

anyhow, an easy-to-use tool to create an .exe from your .jar is NativeJ, an even easier approach to your question would be the search function, since this question has been asked (and answered) a lot of times before.
There are two ways you can do this. One of them is as described above to pack all .class into one executable jar file which can then be run on any PC that has JRE installed. This can be done through the use of a manifest file (you need to write the main class name into the manifest file so that it knows which class to run). You can lookup this procedure on either the Sun's site or any site that has information for creating executable JAR's. One risk that this procedure runs is that you are basically shipping all your class files which can be potentially decompiled and your source code be exposed to other parties. So if you have the concern of keeping your source code closed you can use the second method mentioned here.
The other method is to use some kind of Java-to-EXE converter software which would take all the class files and optionally the manifest file as input and produce an EXE file as an output. Some of them take theexecutable JAR as input. Shipping an exe file essentially keeps your source code protected. You can also optionally have JRE embedded into the EXE creator during input so that if the target PC does not have JRE installed already you can do it automatically. One such tool is the JexePack which we use, but since this is a licensed s/w you need to purchase copies of it from the vendor.
The other method is to use some kind of Java-to-EXE converter software which would take all the class files and optionally the manifest file as input and produce an EXE file as an output. Some of them take theexecutable JAR as input. Shipping an exe file essentially keeps your source code protected. You can also optionally have JRE embedded into the EXE creator during input so that if the target PC does not have JRE installed already you can do it automatically. One such tool is the JexePack which we use, but since this is a licensed s/w you need to purchase copies of it from the vendor.
Native executables can be decompiled just as easily as class files. This is a "non-argument".
Edit: And don't ask me how, because I won't tell you. I am not here to instruct people on reverse engineering. I will say this though, "Just because you don't know how to do it, does not mean that it cannot be done."
Edit: And don't ask me how, because I won't tell you. I am not here to instruct people on reverse engineering. I will say this though, "Just because you don't know how to do it, does not mean that it cannot be done."
Last edited by masijade; Nov 28th, 2008 at 6:26 am.
Java Programmer and Sun Systems Administrator
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
Hi,
I was recommending just a course of action to a person who seems to be in need. But you look to be insterested in restricting the power of langauges so much that nothing other than the opinions you have seem to be valuable to you. We are certainly not here to discuss how much you and I know, but to solve each others problems. I have just expressed my opinion and the original poster can as well not take my opinion if he feels so. But atleast I offered a solution which you did not even try to. You seem to look so busy in showing off your knowledge.
I was recommending just a course of action to a person who seems to be in need. But you look to be insterested in restricting the power of langauges so much that nothing other than the opinions you have seem to be valuable to you. We are certainly not here to discuss how much you and I know, but to solve each others problems. I have just expressed my opinion and the original poster can as well not take my opinion if he feels so. But atleast I offered a solution which you did not even try to. You seem to look so busy in showing off your knowledge.
•
•
•
•
Shipping an exe file essentially keeps your source code protected.
even so, the question had already been answered, and both answers you gave:
1. create a Jar file
2. use a native program to create an exe
have already been suggested as option, so the only new thing you contributed was another name of a native program, and the error which I quoted you on.
no need to act like an insulted child if someone points that out, since, as you say, we are here to answer these questions and to make sure the original starter of the thread knows what answers contain errors, because, as you put it, we do have our knowledge, and we can filter out the errors, but the starter can't, or he/she wouldn't had to start this thread.
No, I was refuting your statement of "Shipping an exe file essentially keeps your source code protected".
You are more than welcome to help, but posting false information (knowingly or not), does more damage than good.
Edit: And that statement that was being refuted is definately not an opinion.
You are more than welcome to help, but posting false information (knowingly or not), does more damage than good.
Edit: And that statement that was being refuted is definately not an opinion.
Last edited by masijade; Nov 28th, 2008 at 6:55 am.
Java Programmer and Sun Systems Administrator
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
•
•
•
•
I had a customer once who wanted .exe files instead of .jar files *sigh* guess how happy he was when he found out his program didn't work so well in Linux
Just install the JRE on linux and off you go.
•
•
•
•
"Shipping an exe file essentially keeps your source code protected".
Just make a .jre
If i am helpful, please give me reputation points.
![]() |
Similar Threads
- Windows Explorer Keeps Restarting!!Help!! (Viruses, Spyware and other Nasties)
- Windows Explorer Keeps Restarting!!Help!! (Windows Vista and Windows 7)
- Microsoft Visual C++ Runtime Library C:\WINDOWS\explorer.exe (Windows NT / 2000 / XP)
- Windows File Explorer and Related Objects Would NOT Open! (Viruses, Spyware and other Nasties)
- Desktop folder shortcuts makes explorer.exe quit, can't double-click (Viruses, Spyware and other Nasties)
- A agntsrvc.exe file error (Viruses, Spyware and other Nasties)
Other Threads in the Java Forum
- Previous Thread: problem with mouselistener
- Next Thread: How to auto save data from a running application using java
Views: 5554 | Replies: 19
| Thread Tools | Search this Thread |
Tag cloud for Java
3d @param affinetransform android api apple applet application arc arguments array arrays automation binary bluetooth byte c# chat class classes click client code compare component corrupted database detection draw eclipse error event exception file fractal game givemetehcodez graphics gui guitesting helpwithhomework html ide image input integer j2me java java.xls javaprojects jmf jni jpanel julia keytool linux list loop map method methods mobile netbeans newbie number object oracle os pong print problem producer program programming project projectideas read recursion reflection replaysolutions rim scanner screen server set size sms socket sort sql string swing terminal test threads time transfer tree web windows






