Rocky Jaiswal - JRuby with JBang

submited by
Style Pass
2024-12-22 18:00:02

Well, it is that wonderful time of the year where we are at home for a few days enjoying the company of our family and feasting on all kinds of tasty treats. So first of all I would like to wish you a Merry Christmas! As the days melt into each other and us developers find some free time and venture into Advent of Code and similar shenanigans, I stumbled upon JBang which allows us to run Java (or Kotlin / Groovy) programs with one command. Officially JRuby is not supported, though I was intrigued.

I was a Ruby developer a while back (these days it's mostly TypeScript, and if I get lucky some Kotlin) but being a Java developer from around 2002-2010, I always found JRuby to be an exciting technology. Simply put it holds the promise of JVM performance and the productivity and pleasure of developing in Ruby (Kotlin is the only language that comes close to this). I will not go into the details of JRuby but simply put I always wanted to use something like Javalin with JRuby. However while JRuby has good support for the Ruby ecosystem dependency management tools (like Bundler) it is a bit lacking on the JVM side, which has complex tooling like Gradle and Maven.

It is a pain to manually download Javalin "jars" and their dependencies, and as you add / need more libraries it is futher painful to download moar dependencies (and their own dependencies) manually and keep them updated etc. So I shelved the idea of using Java ecosystem libraries with JRuby, even though this setup holds a lot of horsepower under the hood specially with recent innovations like Virtual Threads on the JVM.

Leave a Comment