Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • September 01, 2015, 11:25:58 PM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Java to exe converters  (Read 11037 times)

arunpawar

  • Participant
  • Joined in 2007
  • *
  • Posts: 60
    • View Profile
    • Donate to Member
Java to exe converters
« on: March 14, 2008, 06:06:38 AM »
Is there any quick and easy way to create an executable file from java source files?
As using .jar files sucks many users can't understand what it is and there is supposed to be a way if we're targetting java programs for widnows only users.I know creating exe will take away the mere purpose of java program but what if i want to make it available for windows user (who knows only clicking on exe file to run program).Jar file and webstart methods are tried earlier but they're not what i want,also i tried most of the google search.

I also came across blog which explains not to create exe,instead create webstart and jar file for users.But i want to know is there any  native compiler for this,a dn how we can create java to exe using this.MANY google searches are being forwarded to such blogs who dont recommend this way,why people hate to create EXE for windows users.

plz let me knw if any tricks are there.

tinjaw

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,927
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: Java to exe converters
« Reply #1 on: March 14, 2008, 08:28:19 AM »
The short answer is that you don't want to do that. I'll try to explain why.

But i want to know is there any  native compiler for this,a dn how we can create java to exe using this.

You cannot do this. jar files contain code that is compiled already, but compiled to byte code. This is then run on the Java Virtual Machine that knows how to interact with the underlying operating system.

Technically, what you are looking for is a cross-compiler. One that takes java source code and cross compiles it to something like C++ object code so it can be compiled to native windows code.

Yes, the preferred way is to use webstart. However, if you want an exe, I would suggest the following. Use Auto IT or AutoHotKey and create a exe that just calls java.exe (or javaw.exe) and passes it the jar file as a parameter. This would allow you to maintain the java as a jar file (so it can be invoked the "normal" way) and still have an exe for the "other" users.

f0dder

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 8,858
  • [Well, THAT escalated quickly!]
    • View Profile
    • f0dder's place
    • Donate to Member
Re: Java to exe converters
« Reply #2 on: March 14, 2008, 09:17:16 AM »
There's nothing that really stops anybody from creating a JAVA compiler that does native output, even if the language was designed to create binary portable output. GNU is doing this with their gcj project, for instance. And you could also still compile to .jar format, but bundle with a JVM into a .exe - iirc this was possible with Microsoft's Visual J++, but that was discontinued because of pressure from SUN.

But the best general solution is probably to follow Tinjaw's advice :)
- carpe noctem

arunpawar

  • Participant
  • Joined in 2007
  • *
  • Posts: 60
    • View Profile
    • Donate to Member
Re: Java to exe converters
« Reply #3 on: March 15, 2008, 01:41:45 AM »
there are plenty of projects like processing,wiring and swarm who uses java and let you create create .exe of their respective scripts,but actually as they are dependent to their own projects.
i have asked many developers on their forums but the core develoeprs are not online so they're yet to answer the question that how java code is compiled into exe.

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: Java to exe converters
« Reply #4 on: March 15, 2008, 06:56:31 AM »
Maybe this will do?

tinjaw

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,927
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: Java to exe converters
« Reply #5 on: March 15, 2008, 07:12:10 PM »
Maybe this will do?

I hadn't seen that before. That looks nice.

agentsteal

  • Honorary Member
  • Joined in 2007
  • **
  • Posts: 75
    • View Profile
    • Donate to Member
Re: Java to exe converters
« Reply #6 on: December 01, 2008, 08:20:51 PM »
This program converts .jar to .exe:
http://www.mpowers.net/executor/

mahesh2k

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 1,412
    • View Profile
    • Donate to Member
Re: Java to exe converters
« Reply #7 on: January 17, 2009, 01:08:07 PM »

MagicGuy52

  • Supporting Member
  • Joined in 2012
  • **
  • Posts: 1
    • View Profile
    • Donate to Member
Re: Java to exe converters
« Reply #8 on: December 29, 2012, 01:48:40 PM »
Personally I have always wanted to make a native code single executable which didn't require an installer.
I have researched pretty thoroughly on this topic and these are my results:

1.Native code compilation is pretty much counter-productive to the main purpose of Java(platform independent language).

2.Because of this there are not many ways to do it.

3. The best surviving two are Excelsior Jet and the GCC.

4. I have as of yet been unable to get the latter to work and the former seems to only allow one to make an exe which requires their custom jre (one or two files).

5. No solution I have found yet(excluding the gcc about which I don't know) makes true native code independent of an rte. The best you can seem to do is make an installer for the program and the rte.

6.At long last I found what seems to be the closest thing to what I want.

Basically you use Excelsior Jet to compile the code with their custom rte and then use 7-zip to package the exe and the rte into a new exe.  

It won't be lightning fast, but it will do what you want.

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 34,976
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Donate to Member
Re: Java to exe converters
« Reply #9 on: December 29, 2012, 03:03:12 PM »
Welcome to the site MagicGuy  :up: