r/java • • Apr 20 '21

Java is criminally underhyped

https://jackson.sh/posts/2021-04-java-underrated/
291 Upvotes

295 comments sorted by

View all comments

Show parent comments

4

u/maxandersen Apr 21 '21

Try jbang and you get command line utilities / scripting. Add some quarkus and you can easily make it start fast with its native compile.

Java moved alot in this area the last 1-2 years :)

1

u/deadron Apr 21 '21

I don't really get why you would use jbang for anything. If I am producing a runnable application I can produce an executable jar already. I just don't understand what the benefit is to it instead of using an existing build tool.

As I understand graalvm still is not compatible with everything. It also doesn't really seem popular with real world developers even though it's being pushed everywhere on reddit. Probably because none of us can use it with any of our existing applications due to said incompatibilities. For example spring is still incompatible.

2

u/maxandersen Apr 21 '21

if you are fine using maven/gradle and whatever keep using it - jbang can still be used to run that output without user having to install and setup java.

if you are fine with the ceremony of dealing with multiple artifacts and multi nested directories just to write a utility keep doing that - jbang lets you just have one file (like bash, python,etc.) and use that directly - no separate build/compile step.

if you love to deal with maven/gradle requirements to do a few things in a project then do that - jbang lets you just write a .java file and run it any kind of project and be used as a debuggable and portable set of utilities not tied to specific build system.

Coincidentally I'm talking about this exact topic in a few hours if anyone interested: https://www.meetup.com/BarcelonaJUG/events/277506478/

1

u/deadron Apr 21 '21

If you annotate a file with JBang specific comments is it still really a Java file? At that point it seems more like a JBang script instead.

Having to install JBang instead of a JDK isn't really a benefit because it is not actually simplifying the fact that you need to install something to run your code.

It sounds like it operates as an alternate build system focused on execution instead of packaging that annotates within existing files instead of within an external file. So it actually reduces your portability and ties you to jBang being the only way to execute your project?

→ More replies (7)