This sounds absurd to some developers here cause you'll say just create jar file and distributre to usr but sometimes there is not possiblity of having runtime environment in windows computers.So if we can bundle the enviroment and the setup together then packing into exe and then distribute like most of commercial java application sounds better.But the problem is how to do that?

Ok creating exe will increase the size but that doesn't matter,if there is any freeware tool to accomplish just that?

Dani AI

Generated

Short, practical primer for : there are three realistic ways to give Windows users a single "double-clickable" package.

  1. Build an installer that bundles a private JRE (recommended today).
  2. Create a tiny native launcher (.exe) that starts your JAR and optionally looks for or uses a bundled JRE.
  3. Produce a native binary with an AOT compiler. Note: Excelsior JET was a commercial AOT product mentioned earlier, but it was discontinued. (en.wikipedia.org)

Current best-practice (modern, supported): use jlink to create a minimal runtime image for only the modules you need, then use jpackage to produce a Windows EXE or MSI that contains that runtime. jpackage is the official packaging tool and can produce platform installers while including the runtime (jlink can be run by jpackage or provided explicitly). Example (non‑modular app):

jpackage --type exe \
  --input out/libs \
  --main-jar myapp.jar \
  --main-class com.example.Main \
  --name MyApp \
  --app-version 1.0 \
  --icon myapp.ico

This is the current, supported path for bundling a runtime and producing a native installer. (openjdk.org)

Other options and tradeoffs: wrappers like Launch4j or JSmooth make a native EXE launcher (good UX) but do not by themselves solve runtime delivery — pair them with Inno Setup or NSIS to bundle or install a JRE. GraalVM native-image (AOT) can produce a true native executable but requires extra work for reflection and some libraries. (launch4j.sourceforge.net)

Quick checklist: pick matching bitness (x86/x64), test on a clean VM, sign the EXE/installer, and check JRE redistribution terms (Oracle vs OpenJDK builds). Many teams prefer redistributable OpenJDK builds such as Eclipse Temurin (Adoptium) when bundling. Plan update/patching for any bundled runtime. (oracle.com)

Recommended Answers

All 13 Replies

Read this, it holds some interesting info

commented: Nice link :) +2

Thnaks but this site says i can't i should'nt.and it is redirecting me to some commercial apps.

Then how mozilla creates it for firefox? EXE including the JRE? or tmozilla writes it in native for each platform.

If you read more then first 5 lines you will find out more

Use something like IzPack (http://izpack.org/) to create an installer can install the JRE if necessary.

There is just NO valid reason to think you absolutely have to create an exe for a Java app. You are much better off with an executable jar file.

Executable Jar file can be good but what if want to bundle jar file and runtime environment together.Also Want to check if there is any JRE available before installing it.

Executable Jar file can be good but what if want to bundle jar file and runtime environment together.Also Want to check if there is any JRE available before installing it.

Is this a question or statement?

Once again, you are not reading the articles completely.

And I already told you to use IzPack or something like it if you need to create an installer - which will do exactly what you are asking for.

You guys are not going ahead of that post above.You think there is no way to deal with it.

I have seen many commercial application that use exe for their product.So how to do that?
No matter is recommended or somehting.There is alwasy another way.

commented: Figure it out for yourself then if you do not like the answers to your question. -1

When you come up with solution, please kindly let us know. We always look forward to learn something new.
Other then that, please do not abuse/atack other members of the forum!

You guys are not going ahead of that post above.You think there is no way to deal with it.

Once again, you have not completely read the articles posted in response. Read all of them completely. We have not said, it cannot be done, we have said, it should not be done. Now, go away, as you are either too lazy to completely read the resources suggested, or are too thick to comprehend them.

I was not attacking any one of you.I was just asking to think diffrently,there are ways.

I really appreciate all of your help.But i never mean to offend anyone with anything.

All i can say is i disagree with the article link u posted,i read it i have found the webstart and jar method not useful,so i asked ASAP with alternative.
How u interpret about my thinking is alll upto u.

But that is what we are saying. You have not read it completely. The first article also talks about AOT (Ahead Of Time) compilers, which create executables. So, as we said, you have not bothered to completely read the document, or you did not comprehend it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.