ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Removed Areas > Java

Java to exe converters

(1/2) > >>

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.

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.
-arunpawar (March 14, 2008, 06:06 AM)
--- End quote ---

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.

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 :)

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.

Maybe this will do?


[0] Message Index

[#] Next page

Go to full version