4

I completed my Java project and i want to make .Exe of that project, i used tools like Launch4J,Jsmooth,NSIS,Excelsior JET but the .EXE made by this tools require JRE installation on machine.

My requirment is that i want to make EXE set up file of java project which can run without any java installation on Windows OS Is there any Opensource Tool

Thanks and Regards, Laxman

Jonathan Drapeau
  • 2,610
  • 2
  • 26
  • 32
Laxman More
  • 307
  • 1
  • 5
  • 14
  • 1
    This is certainly possible (although I don't have a link to hand) but is very rarely a good idea. Why do you want to do this? The .exe will not be portable between systems the way a .jar is – Richard Tingle Sep 13 '13 at 12:12
  • i want exe for windows only – Laxman More Sep 13 '13 at 12:13
  • 2
    possible duplicate of [How can I convert my Java program to an .exe file?](http://stackoverflow.com/questions/147181/how-can-i-convert-my-java-program-to-an-exe-file) – Jonathan Drapeau Sep 13 '13 at 12:16
  • i tried that sir but i want run that exe without installing java – Laxman More Sep 13 '13 at 12:17
  • @JonathanDrapeau Laxman is right, the answers in the duplicate all seem to be for wrappers and installers – Richard Tingle Sep 13 '13 at 12:19
  • This one maybe: http://www.excelsior-usa.com/jet.html – maba Sep 13 '13 at 12:20
  • @RichardTingle also, the OP wants an open source solution that runs without JRE, things that I couldn't find in the duplicate – Math Sep 13 '13 at 12:23
  • @RichardTingle Strange, the 2 answers here are part of the answers of the linked question. The provided link of maba is also there. It looks pretty much like a duplicate to me. – Jonathan Drapeau Sep 13 '13 at 12:23
  • @JonathanDrapeau The linked question is quite old and most of the answers are from around 2008 so there can be some new tools that has not been posted there. – maba Sep 13 '13 at 12:25
  • @maba The question is but the answers seem to cover all the possibilities. Nevermind, it's a wrapper too, there's seem to have very few possibilities to do what is asked. – Jonathan Drapeau Sep 13 '13 at 12:29
  • @LaxmanMore What was wrong with [Launch4j](http://launch4j.sourceforge.net/)? It seems to support bundled JREs so it does not require a JRE installation. – maba Sep 13 '13 at 12:30
  • Why is this tagged xml? – Ian McLaird Sep 13 '13 at 12:32
  • @Ian McLaird actually my program is for xml creation using user input so it is due to my mistake – Laxman More Sep 13 '13 at 12:34
  • @maba i am trying with launch4j, i will reply soon abt it – Laxman More Sep 13 '13 at 12:35
  • @maba Launch4j requires jre environment. – Laxman More Sep 13 '13 at 12:38
  • @LaxmanMore It says on the front page: *Works with a bundled JRE or searches for newest Sun or IBM JRE / JDK in given version range.* – maba Sep 13 '13 at 12:41
  • since i didn't get solution of my question – Laxman More Sep 13 '13 at 12:55
  • I think honestly if you want a native exe, then Java was the wrong choice of language. Whatever tool you use will require some kind of runtime environment. Even native-compiled languages like C still require the standard lib, which may require installation if it isn't an appropriate version, unless you statically compile. Java just doesn't work this way in practice. – Ian McLaird Sep 13 '13 at 13:08
  • possible duplicate of [How to package executable JAR file into EXE](http://stackoverflow.com/questions/17176900/how-to-package-executable-jar-file-into-exe) – Petay87 Aug 26 '14 at 11:36

2 Answers2

0

There's GCJ:

GCJ is a portable, optimizing, ahead-of-time compiler for the Java Programming Language. It can compile Java source code to Java bytecode (class files) or directly to native machine code, and Java bytecode to native machine code.

Nevertheless, this solution is far from perfect and probably only applicable to a limited subset of projects:

  • lack of support for Java 1.5 and higher (but maybe here retrotranslator can help)
  • very partial AWT support.
  • library has several packages from the standard java class library still missing
fvu
  • 32,488
  • 6
  • 61
  • 79
  • 3
    Yes, but it's terrible. There are large swaths of the core Java library that are missing or only partially implemented, and it's not compatible with even JDK 1.5. I wouldn't recommend this for any real production application. – Ian McLaird Sep 13 '13 at 12:17
  • 2
    @IanMcLaird Well I upvoted your comment :) but I'm not aware of any other Java --> Native compiler... – fvu Sep 13 '13 at 12:21
  • Neither am I, which is why I didn't downvote the answer. ;) Sadly, if you want Java -> native, I think GCJ may be the only show in town. – Ian McLaird Sep 13 '13 at 12:30
  • 1
    @IanMcLaird edited to add some of the most problematic issues with gcj, maybe this can help future visitors. – fvu Sep 13 '13 at 12:56
0

You can try exe4j application that converts sources (class/jar) to exe file

Maxim Shoustin
  • 77,483
  • 27
  • 203
  • 225
  • 2
    From that website: "exe4j helps you with starting your Java applications in a safe way, displaying native splash screens, ***detecting or distributing suitable JREs and JDKs***, startup error handling and much more." which is exactly what OP wants to avoid. Nice tool though. – fvu Sep 13 '13 at 12:16