Similar Posts

Subscribe
Notify of
6 Answers
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
jo135
6 months ago

Yeah, with GraalVM native, that’s pretty good: https://www.graalvm.org/latest/reference-manual/native-image/

But has certain limitations when programs work a lot with Reflection. Java is now a language that happens a lot at the runtime, and that with full intention.

It should therefore be considered in what cases of application it makes sense at all.

EchoTech
6 months ago

Yes, for example with GraalVM Native Image

Franky12345678
6 months ago

A real .exe becomes difficult.

You’d have to put the Java VM in, be independent. This is legally problematic and simply doof.

So I would do it:

Take some programming language that can generate slender .exe that does not need any other runtime environments (e.g. C) again and thus implement this logic:

//Pseudocode!
void runProgram() {
	String javaPath = findCompatibleJavaInMyDirectory();
	if (javaPath == null) {
		javaPath = findCompatibleJavaInSystem();
	}
	if (javaPath == null) {
		runJavaInstallationGuide((result) -> {
			if (result.isSuccessful()) {
				runProgram();
			}
		});
		return;
	}
	if (!runCommand(javaPath + " -jar blablubb.jar")) {
      new ErrorMessageBox("Programm konnte nicht gestartet werden").display();
  }
}

Compile and add to your program.

The same for Linux and MacOS

Now your program has an OS-native start file that can link your installation routine to.

If the user starts and Java is missing, he must runJavaInstallationGuide. If you think that’s user-friendly, he’ll get it.

jo135
6 months ago
Reply to  Franky12345678

For Christ’s sake. First, you can compile Java with Graal today quite well AOT. Secondly, there have long been good solutions in the JDK for the co-packing of JVMs in installation packages, so that such a hand-made pudding is not necessary (jlink, jpackage).

Euphoreon1980
6 months ago

Must join the previous speakers. Languages without a framework are simply better suited for this.

RUST or GO would be my choice. C# needs the .NET framework again. I’ve been out for a few years, but isn’t that an integral part of Windows? Most have it on the computer because any program always uses it.

I don’t like Java personally, but that’s a matter of taste. The UIs always looked gruesome, and it has accused me that there were always conflicts with versions.

jo135
6 months ago
Reply to  Euphoreon1980

The UIs always looked cruel

Are there reasonable GUI libraries for Go or Rust? I don’t know anyone who builds any GUI applications. Practically everything CLI or any services.

and I was accused of having conflicts with versions.

Conflict with what? Java was a favor according to the “DLL source” of the classic Win32 apps: pack all dependencies in the build if you like the JDK too, and there are no conflicts guaranteed. The JDK itself is just too religious backwards compatible, which was never the case at .net, for example, again the same madness as at the time.