• Advertisement
Sign in to follow this  

Converting .jar -> .exe, is the JVM no longer used?

This topic is 2102 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Just a newbie Java question I have, because I read something about .exe files that I'm not sure what to think of. So let me ask:

When you convert a .jar file to .exe, will it stop using the virtual machine and require the OS instead? And what is the logic behind the answer?

Share this post


Link to post
Share on other sites
Advertisement
There is no proper answer without more information. There exist several tools to wrap a Java .jar file into an executable, what exactly is done depends on the tool used.

Share this post


Link to post
Share on other sites
[quote name='BitMaster' timestamp='1334751733' post='4932457']
There is no proper answer without more information. There exist several tools to wrap a Java .jar file into an executable, what exactly is done depends on the tool used.[/quote]

Oh ok. Well, I guess I was asking if making something into an .exe had anything to do with it being compiled all the way down to the machine language. But I take it your answer is "no, not necessaily" then?

What I've specifically done, is to use Eclipse for the coding, then use cmd to compile it to .jar (because I've been too lazy to figure out if Eclipse can do it LOL). Then, from .jar to .exe I also used the cmd. I'm completely new to the details of how file conversions affect files, so that's why I'm asking.

Share this post


Link to post
Share on other sites
There are ways to do so, for example, the [url="http://gcc.gnu.org/java/"]GCJ compiler[/url] can compile (most) Java down to native machine code.

However, while it does allow your program to execute without the JVM being installed, it comes with certain disadvantages. For one, you need to also compile all 3rd party libraries to native code (which generally requires source-code access). And the originally intended benefit (increased performance) has been largely made irrelevant by improvements to JIT performance in the JVM.

Share this post


Link to post
Share on other sites
If you're looking to make your game able to run on Windows without the JRE being installed, you can also use Launch4j. It allows you to bundle the JRE of your choosing into the .exe file or the equivalent of a .exe on each platform.

Share this post


Link to post
Share on other sites
Ok thanks guys. I wasn't actually trying to make it not require JVM, I just wanted to know how things are. Cheers. [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]

Share this post


Link to post
Share on other sites
[quote name='DrMadolite' timestamp='1334755037' post='4932468']
Then, from .jar to .exe I also used the cmd.
[/quote]
Out of curiousity: how did you do that?

Share this post


Link to post
Share on other sites
[quote name='brx' timestamp='1334762908' post='4932495']Out of curiousity: how did you do that?[/quote]

Oh man, I completely forgot by now, and I can't seem to find the video that showed how LOL. String epicFail = true();

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement