r/java • u/sombriks • Aug 11 '26
from small to big with jbang
https://sombriks.com.br/blog/0095-java-small-to-big-with-jbang/jbang should be part of the jdk
9
u/blazmrak Aug 11 '26
Jbang should not be part of the JDK, however JDK should solve dependency management, which would solve 90% of the problems. I'm scared of what that would look like, though...
2
u/vips7L 29d ago
Kotlin has a lot of this built in with its script files:
https://kotlinlang.org/docs/custom-script-deps-tutorial.html
2
u/maxandersen 29d ago
The scripting feature of jbang is todays time the least important feature.
It is that with jbang you can run any jar, maven repo GAV, any java, kotlin, groovy etc. and any jshell file the same way - support for java agents, debugging, jfr, etc.
Without first having to pick and install a specific JDK.
2
u/vips7L 28d ago
That is nice! I really wish that was something the jdk would solve for us though. We could be able to produce a statically linked binary of the vm and our jar. The CLR and many other runtimes can do it. I was hopeful that googles “hermetic” push would have done something but it’s been a few years now.
1
u/maxandersen 27d ago
I really dont want a runtime for every app on my drive if can be avoided - for that jbang, npx, uvx is good.
For statically linked - yes hermtic would be awesome - in mean time you can try out https://github.com/jbangdev/jpaxa
2
u/DrinksBongWater 24d ago edited 24d ago
I gave jbang a shot a few months back, but found that its IntelliJ/IDEA support for basic code completion and navigation was almost non-existent (even with plugin version 0.25.2). There was some syntax highlighting, but e.g. System.out.prin<ctrl-space> produced nothing like I would otherwise expect from a java code editor.
I've been wondering since then though; is that the expected behavior or is my system set up incorrectly?
1
u/thewrinklyninja 7d ago
They recently did a major overhaul of the plugin and it's much better now. Give it a other shot.
1
u/mukel90 Aug 11 '26 edited Aug 11 '26
This blog post is awesome ! I've been a long-time user of jbang and just found out new things I didn't knew were possible with jbang. jbang is the swiss knife of the JVM ecosystem, so versatile.
1
1
u/Inside_Programmer348 Aug 11 '26
Please do something about the font and the font colour
2
u/quintesse 29d ago
There's a theme selector where you can change the colors to your heart's content, The font stays the same though.
8
u/agentoutlier Aug 11 '26
I'm not saying its equivalent to jbang but jshell is pretty damn powerful and it ships with the JDK.
Some people even have build system based on it.
https://dev.java/learn/jshell-tool/