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

Started by
6 comments, last by Ronnie Mado Solbakken 12 years ago
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?

- Awl you're base are belong me! -

- I don't know, I'm just a noob -

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.

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.


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.

- Awl you're base are belong me! -

- I don't know, I'm just a noob -

There are ways to do so, for example, the GCJ compiler 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.

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

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.
Ok thanks guys. I wasn't actually trying to make it not require JVM, I just wanted to know how things are. Cheers. smile.png

- Awl you're base are belong me! -

- I don't know, I'm just a noob -


Then, from .jar to .exe I also used the cmd.

Out of curiousity: how did you do that?
Out of curiousity: how did you do that?


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

- Awl you're base are belong me! -

- I don't know, I'm just a noob -

This topic is closed to new replies.

Advertisement