by maxandersen | 2026-01-01 16:06:47+00:00
I'm sorry, but this is a big load of crap and that includes some of the comments in here. Java enthusiasts are the absolute world champions of sugarcoating the shortcomings of Java and the JVM in general.

Love you too.

This is what writing a CLI application in Go looks like: you download Go and immediately have all the tools needed to manage dependencies, write applications, and compile them into lightweight, distributable binaries with a simple command.

Check - agreed.

Now, let’s consider how this process looks in Java....<rant>

It feels like you missed the last 5 years of improvements..so let me show you how this works in java when using jbang:

You download JBang, and immediately have all the tools needed to manage dependencies, write applications, and run other Java applications with a simple command.

Since you probably don't believe me I'll show you some of it here:

`jbang init -t cli hello.java` - you get a hello.java that declare picocli dependencies and you can run it as `./hello.java`, you even do `jbang app install hello.java` and just use `hello`. You can do this with your own scripts, preexisting jars or existing Maven artifacts.

- yes it will also have downloaded right JDK for you; you can easily swith to other versions, either `jbang --java 25 hello.java` or even `jbang --java 8 hello.java` if you really wanna go back in time :) The java version can be baked into your script or jar so it is NOT a requirement for your end user to be aware.

`jbang edit hello.java` will offer to install vscodium based IDE that gives you an IDE environment to write java in.

`jbang export fatjar hello.java` gives you a runnable fat.jar

`jbang export maven|gradle hello.java` gives it a full blown maven/gradle if you are forced to be Enterprise Compliant :)

You can even run and distribute these sources by just commiting to a github repo and just do `jbang <repourl>` or use jbang catalogs etc. Lots of opportunities.

Reading this and reddit thread I see that the final publish of jars/executables is still too tedious I'm going to try solve that challenge as we have all the pieces (IMO) with jbang/jreleaser and modern JDKs.

Then there's Graal Native, which allows you to compile your applications ahead of time into natively executable binaries.
However, compiling Java applications ahead of time is complicated by runtime class initialization, reflection etc. which is why the Graal compiler needs significant configuration beforehand. There are tracing agents to help you compile such configurations, but even with them, it’s incredibly tiresome and not always reliable. Furthermore, the produced binaries tend to be large and don't play well with upx.

don't play well with upx - how so? yes there is the usual upx overhead but "just works" when I tried using it?

about graalvm native - definitely not going to say its perfect nor easy; but Quarkus definitely have a whole ecosystems of java libraries and framework setup that just works when using native builds.

That said - I think we dont need to go to full native for lots of usecases.

I think the JDK developers could learn from Scala CLI, which is now the default Scala runner. I'm convinced it would really help Java if it came with something like that out of the box.

Yeah, I couldn't wait for JDK developers to do it so I built jbang to make that available today.