Jonathan: Hey folks, this week Jeff joins me and we talk with Max Anderson about JBang. It's a little utility to make Java easier to use and run it as a scripting language if you really want to. It's a lot of fun, you don't want to miss it, so stay tuned. This is Floss Weekly, episode 801, recorded Wednesday, September 17th.
It's not your parents Java anymore.
It's time for Floss Weekly. That's the show about free Libre and open source software. I'm your host, Jonathan Bennett. And today, it's going to be fun. It's going to be interesting. It's going to be Java. Which That's okay. We mostly like Java here. It is not just me. Of course I have, I have Mr. Jeff Massey, the one, the only Mr.
The, the other, Mr. Lennox here with us to talk about J Bang, which is an interesting project all about, from what I could tell, it's using Java as a system scripting language, which is sort of interesting. What, what do you know about this, Jeff?
Jeff: Not a lot. When you, when you first got a hold of me, I thought for a moment you were talking about JavaScript.
Well, it sort of
Jonathan: is. It's Java space script.
Jeff: Yes, not one word. So that's where, I was a little confused at first. So I'm, I, I'm not a real I don't have a lot of experience in Java. So very, very little, but I'm interested to hear about this and kind of the direction they're taking it.
Jonathan: Yeah. Now we talked before the show, it's like, well, Couldn't you just do this with like an alias to the Java binary?
And so, you know, JBang would just then be an alias to Java and that's the show. Thanks for coming, everybody. We'll see you next week. Apparently there's something a little more to it than that. It's a little more complicated. There's more wrinkles, there's more hair on that problem. So, looking forward to learning.
The level's always in the details. Yeah, always, always. Looking forward to learning about that. Let's not let's not take any more time to bring him on. We have Max Anderson is the guest today, the, I believe, the creator of J Bang. Welcome, sir! Welcome. Well, thanks for having me. Yeah. Now, creator Jbe, right?
You're,
Max: you're the man. Yes. I created it after being a year away on a sabbatical, not doing anything not doing anything, work for latest, so to speak. Right. And yeah, and I, I'm happy to be here and, and be in a place where everyone loves Java and wants more Java and all that
Jonathan: kind
Max: of
Jonathan: thing. Java was I've, I've told this on the show before, but John Java was one of my early programming languages.
And so some of the like difficulties and learning how to program and like, what do you mean a pointer error? And why I didn't even think Java had pointers. Why is the log telling me about, so some of that, like, you know, I just, I have this sort of deep seated annoyance with Java because I was programming it when I didn't know what I was doing.
Max: Yes, I see that repeatedly again. People have, well, most people have learned or touched Java, but they mainly have touched it at a time either in their career where they were not, like, that was not a good, it was not a good learning language in the early stages. But it got super popular because it could run anywhere, right?
It could, you could run both on Linux and Windows and eventually Mac and that kind of thing. And phones and, I mean, for a while there were DVD players and everywhere, yeah.
Jeff: Everywhere.
Max: Yeah, it was, whatever devices were there, right? So so I worked in Java for, I've done professional open source 20 plus years.
Mm hmm. I've my day started at Hibernate and, and, and Persistence Solution, that kind of thing. And then I started doing tooling. And then I, I had, um, what's it called? Well, 10 years, 15 years of work and came back. Well, then when containers came around, Java had a problem because it's too heavy and, and, and, and and I was tasked on doing some other tooling in go land and JavaScript.
And I got to touch on that. But then I, I took a break for a year. And I promised myself I'm not going to touch any programming for the least three or four months. And on the first day I break my ankle and have to be not moving for another days. I decided not to touch Java, but go into Python instead.
I knew Python from like 20 years old. And I had fun with that. And then when I came back to actually work on a product called Quarkers, which can make Java work with containers, I was like being super or realizing how complicated Java is like in the minds of people. But when you refresh yourself on what's actually happening in the last X number of years, You realize, hey, there's no reason why it should be hard to use Java.
And I then, as a way to update my knowledge about Java, sat down and said, hey, let me try and make like, there's this the product Quarkus was using in their release engineering, release scripts, they're using Kscript, which is, it's Kotlin scripted. And Kotlin is considered a more lightweight language, but I was like, why are we required to install Kotlin on top of this Java when the script is just doing some file automation stuff, right?
So I took the DSK script head and applied it to Java and that's where the scripting part comes from in JBang. And then I realized, hey, I want to have, The same experience I want to be able to, because the reason why I like Java is all the tooling around it, like the debuggers, the IDE, the content assist, the refactoring.
But the problem was that when you try and do that in a scripting way with JBang, All that tooling falls apart. And then it becomes at the equal terms as Python and Ruby or Node or whatever. And then Java doesn't hold up. Like, then those languages are nicer. But I was like, no, no, no, like we have a massive, like Java has a massive ecosystem, like the whole Maven central auto artifact, you can download and use and do whatever you want.
And and I said, Hey, let's, let's do this. And then I the, the thing was in Java, I forgot like 10 or 11, the add support for running. without compiling it. But the problem was that to, and you could even use it as a script, you know, like have a what's it called? She bang in, in the top, like what, what pound slash slash dash run something.
but any IDE you do that in will then see that as a syntech error because that command is not part of the job eco system. So no, IDE could work.
Jeff: Mm-Hmm, . And
Max: I was like, oh no, we need to find a way. So that's when I realized there was a trick in go. I think I saw it first, that if you add two, four slices bash and seashell and a few other shells, not fish, shell will treat that as shell commands.
So you can then run it and pipe in the file and Java will just treat it as a command sorry, a comment. And that means you can run any Java file and it'll work in the ID. You can come to this, it works. And that's like, Hey, great. Let me do that with the Java eight, because at the time I was using Java eight, but you couldn't so fast forward, I made it.
So there's a J bank command that you can call that can run Java source file. And. Compile it and then run it. And the advantage over the default job is a, it will cast the result. So therefore it doesn't have to do the compilers already there
Jeff: and
Max: only do the compiler into the file changes. And then the, the one that's the kicker is it can get dependencies that it's just in the file.
So at the top of the file, you can add like slash that steps and then the coordinate for artifact. So and that's, once you have that suddenly you can do things and it works in ID like in the early days I was generating files for ID, but now a few days later we have support in Eclipse.
Intel J and VS code, especially VS code. So now my favorite text editor is, is, is VS code with a J bang plugin in it because I can just be writing in my, my own language. And then on top of that, we started going low. Oh, Because that's the other big thing is, oh, you need to start writing code without having to download an IDE, et cetera.
You need to get Java, but which Java version are you going to run? And so then I added to JBang that it could download, or Taco, who I'm doing it with, added support for downloading. Any, the, the, the version of Java you're there. So now we had a full setup where you install giving which is a one liner install, and then you just create a Java file and you can add dependencies and you can build it.
And you can even, there's even a JBank edit that will actually, if you use your own IDE or download one for you and it's configured. And once we had all those things in place, we suddenly had an ecosystem, a whole setup that anyone can run on any of the three major platforms out there. And then suddenly I realized, hey, any student, any, any experiment I want to do, I can do in seconds compared to, I'll also set up as it was before.
Jonathan: It sounds like you're technically making polyglot files here that are interpreted one way by bash and interpreted another way by the IDE and by Java itself.
Max: That is true. And, and the fun part it's also a poly, Poly, poly, polyOS thing, because the first slash is bash recognizing, Hey, this is a bash command in the start.
The second slash is the Java comment. So it works. But the fun thing is that works on Windows, sorry, Linux and Mac. But if you do it on Windows. It gets interpreted as, I forgot what it is, but it's a UNC
Jeff: path,
Max: so it fails. But if you have a third one, everything's fine. It works in all three. So it's, it's, it's a, it's not a feat, it's a bug in all three that makes it work.
But mind you, you don't need that line. That is literally just for the feature of being able to do Like run the Java file directly to be able to do a dot slash on it. Right. Yeah. Yes. A lot of run the so, so that's, that's the, yeah.
Jeff: Sorry. I was going to say, you know, and I think you, you kind of touched on this, but you know, why did, why did you choose Java?
Was it strictly just because of the infrastructure, the existing infrastructure versus not going, Hey, maybe I want to try to work on, you know, Python or Rust or some other language, you know, So
Max: that was the thing. It's like my professional work life has been in the Java world. And I, I am proficient in the others, but I always, I was before I did my sabbatical, I was like, why doesn't people do that?
Why don't they just use Java more? Like it's so easy to use. Right. But I realized that my 15 years of working, I. I got immune to, oh, you have to find a version of a dedicated download. Oh, you have to find IDE to download. You have to find X, Y, Z. Learn a Maven tool or Gradle tool. And I hadn't realized. It was just everyone in my, like, bubble knew that it's like, like, and people found what's that called?
Like when, when, when you're a group of people who've gone through the same pain and now you're all kind of good and you don't see all the problems, right? And you feel like privileged to you, you, you've got here and then go like, Hey, why is this student that never used program before surprised to, to, to, to this and the, so one of the things you can do with, with well, so, so main thing is.
I like Java. Like, I'm, it's what I'm, the language I, I, I like to do. I also like Python. I like JavaScript. I'm not a fan of, but there's a lot of languages I like, but the whole ecosystem of Java, I just, the whole tooling, the compile, like there's a lot of stuff we can do that none of the others can, can, can do.
But the, the, the So that's why I was like, I was like, when I went on sabbatical, I was like, how hard can this be? Why is it? Is it so hard when I came back because then I had forgotten all these things and I was just Realizing how many steps I have to do so, coincidentally also at the time my son was about Seven or eight six seven.
So he got into minecraft at that time And mindstorms and lego stuff and those two actually uses java in in a setup and i'm like, okay Let me go and show programming with Java to my kid. And I heard about all these kids and, and, and, and teenagers using writing plugins for Java. And I thought, then it can't be hard.
Then there must be a guide in Minecraft land that is simple to get started. And I was surprised that people are even doing minecraft plugins because any product founder had like five or six pages of setting up java To get started. And I realized okay, so they they're going through all this pain Just because, hey, all of their friends are liking Minecraft.
So therefore, that's why they get there. But I was just like, why? And then I realized with the JVang stuff I had, I could literally write, I could, it was made, I made it trivial to write Minecraft plugins in, in, in JVang. Because now it's just a single file and you just have a dependency on the Minecraft whatever Minecraft plugins that we use.
And off you go. Stuff like Again, people don't, well, you guys, you don't know because you, you're not a Java head, so what do you call them? But one of the things I always find insane, like when you do a debug, a Java product. It is literally like a 80 characters. You have to type in of Java does agent connect server equals yes to whatever port.
And I was like, why it's the same. It's it's, it was fine when we 20 years ago, add was a feature. We didn't know how it should look like, but it's just stayed around. And in day bang, that is. D debug and it behind the scenes just do the, the, the, that connection string. And I just chipped along and anything I could find that was like this com, like unnecessary complexity that has organic groan, I just kind of chipped away.
And because I just use a standard Java tooling, it works on anything like, so it it runs on Java eight and artworks. So I could even make it work on Java six and older. I just, no one ever asked for it. So I didn't want to incur the pain, but technically it could. And yeah, no, no. So, so, so Java was just because, you know, that's the thing I like.
I might be weird, but, and there's also a whole enterprise out there that uses Java. And I was tired of hearing this. Oh, when you're using IOT, you have to use Rust or, or Python or, oh, you have, if you do front end something you have to use JavaScript. Oh, and because everyone now do use JavaScript front end, we have to use JavaScript at the backend too.
I have nothing against it, but it's just this like, Hey, like Java can actually do these things too. So don't, don't fall in. I have the same thing with the whole AI movement that everyone thinks, Oh, to use AI, you have to use Python. And I'm like, Hey so this is one, my gimmicky you can actually run J bank from Python now.
So if you have a Jupiter, if you have a Jupiter notebook somewhere Jupiter notebook environment you can do pip install J bank and it will actually, you don't have to do anything. It will set up Java in that environment. And now you can, you can use Java from any. Of those free services like cloud notebooks and others and get access dependencies.
And people don't believe me when I say so, but it is actually doable. So now I claim that Java is the most portable environment anywhere. And with JBang, it's the, it's the easiest thing to set up. Cause I don't know if you actually tried, have you tried to actually set up a Python environment on a Windows machine?
Jonathan: No. Oh, no. That is, that is horrible.
Max: Yeah, because this is the thing like just like the java guys are like in a mindset Hey, you just do these seven steps and you're fine python and node. js is is default installed on mac and linux But as a whole ecosystem windows, which is you know, i'm sad to say but it's the most installed desktop operating system out there Yeah, we're running python is not easy Funnily enough, JBang is one line and you have a full Java environment available to you and it just works.
That's actually really cool. I did think it was funny
Jeff: when you said Java was really easy because I'm like, I don't know if I've heard anybody utter that phrase before. You know, I've always heard there's a learning curve, but so, you know, I totally get who you're surrounded by and what you're in and, you know, yeah.
So, but officially. So I, so I can make sure I have this down. What versions of Java are supported? I know you said you weren't going backwards from. So,
Max: It JPEG itself is compiled and with Java eight. So it can run on any Java eight, um, VM and upwards.
Jeff: Okay.
Max: So, because what J Bang does is it like, it's trivially, it's the simplest product I ever made.
It literally, it's just a little J, it's a Java, it's a small Java app. And it, it just takes input and figures out, Oh, is this a Java file? Oh, I need compile it first. And then I create a Java C command line. And then I. I, I build the classes and then I jar it up and have a jar and then I run the jar. And if it's a, if it's a jar file, I just run the jar.
And if it's a Maven coordinate. I go fetch the Maven dependency. If it's a Kotlin file, I, I run the, the Kotlin compiler. If it's groovy, I do the crude compiler. And in that sense, J bank actually goes beyond just Java, but any JVM based language is, is in theory possible to, to, to in that way run. And because WK team generally are good at having backwards compatible command lines or four compatible ones.
It, it has been reliably working on any version has come out in the last four years. And the cool thing is J Bang knows which version of Java the user is asking for. So therefore, if for some reason, let's say Java 25 is going to break something, I can adjust the, the, the, the generation of the command line stuff.
And then it would just kind of work. So that, that's the way that this, this magically works.
Jeff: Oh, that makes it nice then that, so, okay. I I've got my Java version eight plus whatever. Now to make this a little easier, these complexity reductions that you talk about, are they. Have they made their way upstream?
I mean, are you making life easier for me?
Max: I'm actually, so I work in Red Hat and my main job is actually to work with some of the compiler guys and OpenDK team. And other things and I've been pointing them to some of this stuff, but don't get K team is, is a very like, like it's a really complicated machine but it's like really, really efficient.
Like it's a really, like it's, it's engineered really, really well, but they also use everywhere. Right. So it's kind of like, I think you had an episode about the core was it the core lips, the core tool about how backwards compatible that I think has to be open your case is in that ballpark, but they also want to tweak things up, but they are so they're very conservative, right?
So even if I propose something now, it's going to take. Literally years before it's there. So I haven't done a lot of it, but one thing I've Not sure if it was coincidentally or not But a year after I made the big splash with jbang and and created it And showed, Hey, you can run J bang. And another thing I can also run JCL, right?
So JCL is, is a shell is like this tool in Java where you just run. It's like a, what's called rebel, like one line at a time. I can run those scripts too. And I showed that, Hey, it's you. The only thing you need to have being run, it's just a single file. And. You didn't even have to have a class in around like the whole like public class static void main thing you, you, you don't have to, to, to do.
And then a year or two after to dedicate team has now come out with that, I think it's Java 22. There's a preview support for what I call a naked and naked main. So that's you, the simplest Java thing you do, you can do today. Now is. Void main system up from like, there's no, there's no arcs. There's no class.
There's no imports. They, they actually, that's the one thing that, that, well, it's a thing that they started to, to, to put in. And some of the flags I've been doing like the debug one I've proposed at least to the internal Red Hat team. And I'm actually meeting them this week where I'm now here in Zurich.
And I'm, I'm, I'm gonna. Talk to 'em. So, but again, , this, this, this is so hard to dis do because people are so, like, one thing is that they're used to it, but also just there's so many infrastructure that's Mm-Hmm. , like, if you start, it's, I have the, the advantage that this is not in Java, so therefore I can, I, I can, I can change things a bit.
But I, I do, I, I at least. Find priority. And I think I might have accelerated some of those decisions to simplify Java. And yeah, so I, yeah, I'm trying, but it's, it's going to take a long time. When
Jonathan: you, when you measure, when you measure your like install base in the. Billions with a B you want to be very careful about making changes that could break things.
Yes So you mentioned you you mentioned naked mains i'm curious with j bang do you do you support implied mains? Or when I go to write a j bang script, do I still have to define a main? so so,
Max: So this, so yes you do. And I'll explain what, but, but no, you don't. So there's, so one of the key things I wanted to, was to make sure that the IDEs keep working.
So I could technically, I could make JBang go look in the sources and see, Oh, this is just a naked main. Let me. Behind the scenes generate a a, a, a wrapper around it and, and behind the scenes do something. But if I do that, that job file would not work in any id 'cause none of the IDs currently supports that notion.
Right. So I did not do that. But what I did do, do what I did do is the JS shell support. So JS Shell is this tool that's been in Java since Java nine, I think. Where you can literally just run any kind of Java, like it's, it's a line based execution. And, but the weird, well, I'm not, I'm not saying weird, but a limitation of JShell is, JShell doesn't, are not able to take arguments.
It doesn't handle dependencies. And that's because JCL was built for tinkering. Like, it was like, hey, let me play around with something. Not for use as a main execution engine. But I realized, hey, with JBang, I have a way to run these. So they are still JCL scripts. But I actually handle the command line arguments and parse things in.
And then, so yes, you can do mainless with J Bang back to nine. It is. But it comes with the price that JSON comes with it, which is, it's a slower execution. It's not as fast as everything else. So, so yeah, so the answer is yes and no. So
Jonathan: this ties into something else I was going to ask about are you doing compiling down to byte code?
Like with Python, oftentimes when you run a script, you'll end up with a pyc file hanging around and it does that to speed up compilation. So it sounds like sometimes you compile down to byte code and sometimes you don't.
Max: No, as a, what's it called, conceptually it's the same thing I do. Right. So Python adds the, has these Pisces files.
It says, Hey, this is a compile time. And if, if the, if the file, the timestamp matches the file we will we will use that the Pisces and I do similar thing here. I just, I have a, there's a medical folder and your home directory called dot J bang, where I have a cache. And in there, there's a, there's a, there's traces of what you've been doing.
Right. And and that's the thing. So this is the, the, the, the, the, once people, people have a hard time grokking that it's that easy. But for example the main list, the main list, sorry, a naked main is available in Java 22 and people go like, okay, I can't use that. That takes too long because if you use the normal install, you be complicated.
But with JBang, it's just JBang Java 22. And all this stuff will just be, I'll download a JDK and it'll just run for you. And the same thing is what I do with the, the compilers, the bytecode stuff. I will generate bytecode well, compiler classes. But I'm using the standard. Java C tools, right? So I'm not, there's nothing J Bang doesn't do anything that Java itself can't do.
Right. So, so, so it, I'm very confident that it will be portable for a very long time. As long as the OpenIDK team stays portable, J Bang will,
Jonathan: will,
Max: will too.
Jonathan: What, what about, we talked a little bit about Java versions. What happens if somebody says, here's my J Bang script and it calls for Java. 11 and Java 11 is not installed anywhere on the system.
Do you, do you deal with that or do we just fail?
Max: Yeah, well, yeah. So the, the, Well, if, if you run J when you install J bank, there's no job, no job needed. You can use any package manager and stuff. So basic J bank has nothing. It doesn't even have Java, right? So just have a jar, but it also has a script. So a best script or PowerShell scripts, which is windows.
And that thing will go look for Java and it has a default thing go like, Hey, I'll use the default DDK. That is on your system in your path to run to run JVM. But if that's not there, we will go download, I think it's Java 17 now. There's a, there's an API in the Java ecosystem that's hosted by a, what do you call it, Fujie.
And Fujie has an API to go get all these different variants of JDKs for different platforms. So we, we recognize the system, the architecture, the, the platform, the OS, we get it and download, install it. And then that means now we have the Java to run JBank. But if your script then needs to say, Hey, I, I'm using Java 21.
So you can do that with slash slash Java 21 in the file or 21 plus to say 21 or higher. We then go and look is the current Java at Java 21. Nope. Okay. Go fetch. We installed it in jbank cache and we will go, we will set up for you. So yeah, that, that thing is just. Magic in Java. Like it just works.
Jonathan: Yeah. So something else that might be magic that I want to know about is, again, you've mentioned this briefly, but dependency handling how difficult is it because Java, Java is all about dependencies. Like there's, there's like a million libraries out there. That's like one of the super powerful things about it.
Is it, Hey, I wish I could do this in Java. There's probably a library that does it. How do you pull one of those in? Do you have to, like, include somewhere that, like, here's what it is on Maven and go grab it, or can you just, like, include the class and it'll automatically go look it up? What does that look like?
So I,
Max: I had a prototype for the class thing, but it's just, it's too magical. Like, it becomes, like, things fail. But so, so right now, so it might happen eventually, but right now I use we use a slash slash steps for dependencies and it uses the, the, like the convention it's to say, if you use cradle, they have them all.
So maybe it actually has a syntax for specifying group artifact version classified as a whole language. And that's just the one that we support. And that makes it very compact. And, and that's, that's what we do. And it, it. Yeah, that's all that is it to it. Like slasher steps and you can do it in the file.
You can have a separate file. You could do it on command line. So, and you can combine them so you can have a, let's say you have a a script that does something that says I need out 21 plus. I'm using Hibernate for database access. But I, then when you run it, you need to get a driver, like a square, like in a square, a Postgres.
So then you can go J bank desk steps. The Postgres driver and then the scripts and then these two gets combined. And now when you run, you have access to the, to the driver. So you can, it's very composable in that sense too.
Jeff: Jeff,
Jonathan: you want to
Jeff: ask that? So I, you know, you said you had a cache directory and everything and you're, you know, And I, like I said, I'm not super on Java. So do I end up with a, like a jar file that I, you know, I write my script and J bang, it can run, it can work. Do I end up with a jar that I can then just say, Oh, Hey Jonathan, I wrote this script, but I just sent him the jar file and it runs on his machine or how does
Max: that work?
Yes, you can. Yes, you can. So this is that though. Yeah, exactly. So yeah. So there is actually. There is a jar file in, in, in, in, in the, in the background. Originally I thought that in the early days it was just there because that was an easy way to actually not have a thousand files, but just the jar.
That's one jar that has the whole thing. But then someone, this was actually the, the, the, my the mind Mindstorm, the Lego Mindstorm use case I had for my kid. I needed a jar. That I ran, I had to export it and ship it into a Raspberry, the Raspberry Pi thing that was doing the, the mind thing, the, the, the Lego stuff.
So I had to export it. So there's a J bank export that will generate the jar that the, the results, but it will also depending on how they suppose you can make, make the jar and then copy in next to it, all the dependencies. And then the jar has references so you can just run it. So it's like a a multi file thing on disk.
Or we also have an export fat jar, which then takes all the dependencies and just scrolls into one jar. And you can ship that over and run it somewhere. And there's a bunch of other ways you can like export a container, export other stuff. But yeah, you can actually, you can take those scripts and export as a jar and just give it to someone and hope they have Java.
You can tell them to install a J Bang because J Bang doesn't only work for scripts. It will also work for jars. And then you can, J Bang will go get the right Java version and run that jar for you. So I'm not sure if I explained that well enough. Right. Because then, and this is the thing where, where I was having fun, some weird night, I go like, wait, I can now run the jar locally on my, I can have Java sources, create a jar.
I can export the jar. And I go like, Wait, why don't I just allow you to run any JavaScript, just Java source file or jar that is locatable by HPS or the ASP request. So that opened up for that. You can go and say, not just J Bang a file, but J Bang a URL. And it applies the same logic that it does locally.
It's a jar file. Okay, I download the file, compile it to a jar, analyze dependencies, and all is there. It's a jar file. I run it. I download and run it. It's a main dependency. I fetch the dependency. And I, we actually made it even further. So now we, we have a shorthand. For any GitHub repository or a gist, you know, gist service for, for, for grabbing stuff, you can do gay bang, a gist URL, and we will go and look for Java files in that gist and compile it for you.
So you have something running somewhere you can just, it's now trivially easy to distribute that to anyone, anywhere on the planet. As long as JBang is on the, on the system.
Jeff: Yeah, that's awesome. Because that would be good for, you know, say I write something that I need to give it to my mom, who's not a computer person, I can just, you know, okay, install this, and then do this, and then Yes.
Everything, everything's automatically taken care of.
Jonathan: What is, what does the process look like of installing J Bang itself? Is there just like a, is, is there some little tiny script that you can curl and run that bootstraps everything? Or yeah, you, you mentioned it's available in pip. What are the, what are the options for getting J Bang on a machine?
Max: Oh, how much time do you have? Cause I, I counted it just before here. I think I have about 20, like 90 or 20 different ways you can install JVM. So there is the traditional, like in Linux land, you can curl download thing. Right. But you can also I have there's a, a Fedora package. There's a Red Hat rel package.
There's a standards package. There is It was called ASDF, the installer, there's a Nix package, there's a Docker image, there's a JavaScript module, there's a Python module, there's a GitHub action, there is on Windows, there is if you know, there's a NuGet. And a Choco installer, a Scoop installer, and on Win Brew, there is Sorry, on Mac, there's Brew to go.
So, I, literally, any reasonable Python system that either I was able to make work, or someone in the community has done, We have available to get it. So basically there's no excuse to not install and
Jeff: we talk about this on. The untitled Linux show sometimes, but I did look and there's also a snap that's available for Ubuntu.
Oh, yes,
Max: sorry. Yes. We like to tease back and
Jeff: forth sometimes about that. Some of us are not as excited about the snaps.
Max: Yeah, I know. Yeah. And the snaps and there's the one that there's some Fedora line. I forgot the name now, but the same concept of these isolated ones, which was actually a really a big challenge.
Yes. Yeah, it's like that, yes, right, but it's a very big challenge because I need, like, JBang is, needs a Java to run, right, but if I'm not allowed to run the Java that's on your system, I, it's a very limited use. And one of the things Flatpak does is it's default is sandbox, so you can't do that. So, but we, we found a way and, and Yeah, so now you can use it as a Flatpak and it can run.
But you have to run with like some, Like escalated privileges because you J Bang is calling back to your system to use the Java you have available. So, but yeah, no, no, there's there's there's all all the ways you can think of if one is missing Let me know
Jonathan: Mashed potato mashed potato from our chat room says was compiler from source on that list
Max: Compile So the product is fairly easy to compile You but yeah, but that's, yeah, you can, but it's not, it's not a way I, I I say, Hey, this is how you download.
It's one of the things I learned from early on is any successful, like utility open source product in the first, you have to have working software and two, you have to have it available to release. Yeah, so I'm able to run and that's why in the beginning I was like because I've been doing tooling for 20 years and I had to fight people for, hey, you know what great.
It runs on Linux and Mac. But majority of enterprise customers runs on windows and every linux guy and every mac guy hates me for it It's like I don't want to deal with it. No, no, I know but that's One thing is what you as a privileged guy who have access to all your links You're not the developer runs in a bank somewhere and told to run in this windows citrix hosted somewhere It will it won't run on this stuff, right?
So I I spent That was what, before I ran, I released anything, I want to make sure it ran on all three platforms. And it was, it worked on every release and I could release that very easily. And and that's, so early on, I think we, we had 10 or 12 different ways of packaging installing it, which was really, really hard to do because there was no other Java product that had done these.
Very different ways of setting up installers. And that actually, you had Andres Amorea on about JVelizer a month back or so, and JVelizer actually part of like the way JVelizer got created was I talked to Andres about some of this stuff and he said, Hey, I'm doing a Go thing and GoVelizer has this thing.
Why don't we have this for Java? I said, well, If you make it, I have all the scripts, I have already done all the work on how you make a CLI in Java that can run on the, or be installed by these. So he took that and improved on JReleaser to the point that now JBang is using JReleaser instead of the scripts I created like five years ago.
So it's all all connected.
Jonathan: Yeah. It's a, it's kind of a challenge these days actually to get a Java runtime environment on windows, isn't it? Didn't, didn't like Oracle make some licensing changes to where you got to have a, some sort of agreement with them to be able to download it. Oh,
Max: yeah. So this is another part, like, so no, so no, well, this is fun.
Like it has never been easier to get Java on any platform because what Oracle did or Sonar like years back was they open sourced it and there's all these different teams that makes JDKs available. So yes, Oracle did change their license. Statements and I'm not a lawyer, so don't, but basically it says you can, you can use it for free, but after a year, if you stay on this version, you have to pay Oracle or you upgrade to the latest.
So if you stay in the latest. You're fine with oracles,
Jeff: but
Max: of course, as a red hat or anyone else, so I'll just say, Hey, use any of the other ones, especially Eclipse adoption, which is making a build of OBDK available to you. And there's Amazon and Microsoft and others has DDKs that are available without any of those license restrictions on them and, and.
And then there's this fuj, which is a service that literally gives me an API, like I I in J Bank, I just do, I generate a URL that says, this os this platform, this combination. And it, it will orchestrate, it'll go, oh, you need you want adoption bill for windows on, on this architecture? I'll go get that.
At the actual vendor, right? So there's one place that you can look up and get any kind of data K for on any platform now. So it is trivial easy, but yes, Oracle, of course says, Hey, install the Oracle one, because if you get. That's the one you use, then you, you, you, you, you will want to get support from Oracle and pay for that.
Does, does J bank,
Jonathan: yeah. Does J bank support actually installing? So it sounds like you go with open JDK by default. Do you support actually installing the one from Oracle? And does that ever matter?
Jeff: Oh
Max: yeah. So the default I use is the, what's called Eclipse Adoption. So this is the, maybe you heard, heard the same thing about Omnidecay some years back, there was a, like an alternative to get core, Oracle to realize, Hey, make the binaries more freely available.
So we, I use that because I then are sure that no user that ever uses will end up with a lice, like a. You know, licensed what's called licensing.
Jonathan: Yeah.
Max: But so I don't, so, and also I wanted to make sure that any, any default use of J bang will always get as close an experience. As if, as you have, like, so, for example, Jeff said, Hey, I wrote my script on my Linux.
I'm sending it to my mom or some student was just run a javang. So javang will default download. If you don't have the system, the default system, Java, you'll go download the adoption one. But because we use this FoodJ behind the scenes that can get any of them, there is actually a flag in, I mean, it currently is not exposed in JPEG because I haven't figured out a good way of doing it, but there is an environment where you can say, hey, I don't mind the vendor, JDK vendor should be Oracle.
Or Amazon or Red Hat, and then we will actually go get that one. And that includes and the Oracle ones, et cetera. Where it make it's actually has a use case is when you use early access builds so when there's a new version of something, the open data K community project. Will have binaries before the orders have them like a few days before and then it's nice to do or if for some reason you oracle has some features that are specific to their ddk If you want to utilize those you would want to use the oracle, but that's like I it's a niche case.
So it's not a thing that It's, yeah, there's flags and things you can do it. And I use it all the time for testing weird combinations. Yeah. But so, so no, so yes, it's, it's important. That's the way to do it.
Jeff: Yeah. Awesome. So. You talk a lot about supporting, you know, all three platforms, you know, looking at other open source projects, which ones are successful, how they do it.
So what, what has been the challenge of getting people to, to use JBang, you know, getting users to come in, you know, into the ecosystem.
Max: So, so that's the, that's the, that was the one that surprised me the most, because for me, what I. Built jpang. It was just hey, I want to replace this case with that. Let's just do it and then suddenly I realized Oh shit, I can, I can, I'm sorry, I can do all these things that we just talked about.
And then I go out and showed it to my team, like, and this team, these are like you know, people that have been doing Java for years, and I thought they would immediately be like, this looks awesome, let's go. And they're like, no, no, like, I don't know why this is not using Maven. It's not using Gradle.
This doesn't work in the IDE. Like, why, why, this is not Java. Like, why should I use this? And I go, no, it is Java. It's just a little script. And I've heard so many times people like, no, no, this, this is not what I'm used to. And therefore they just abandoned the idea. And also there's this, say Java is in a enterprise setting, so everything has to be enterprise y.
So if stuff is easy, it's considered not enterprise y. Like it's this weird thing, right? Like I even heard. Someone was like, no, no I, it's, it's called J Bang. It's not Java. So therefore it's not part of the Java ecosystem. And then I point out to them and they say, well, no one will ever use that.
And I put out to them. You do, you do realize Maven or Gradle is part of Java that is a complete separate ecosystem from it. So it should be possible. Oh, that's, you know, that's just how it, you know, it is. And then you go look at this. Oh, it should be as easy to do as you do in Go, right? So for example, Go was, did a brilliant thing.
They actually have all these tooling in like anything is built into. Go like there's a go format or that's a go install all the stuff is there. But that is all copied from like Python and Node. js. So if you look at Python, pip is not part of Python. Pip is a separate thing that Python, the community has adopted.
Node. js and JavaScript, it was originally in a browser. Someone then took it and put it in Node. js and Node. js then made this thing called an NPM. So all the other key systems, which people are saying, Hey, these are easy. Has done what I've, I'm doing it, but in the Java world is considered. Against some religion or something.
That's the, that's my, that's my biggest issue that I generally, when I go out and talk and present, I it's, it's like dividing three people. One is the ones who get it immediately. And like, Hey, I can do scripts and I can run them. I can install them. And that's good. And then there's a group that just, they just.
They, I think if they got it, they've just been so indoctrinated, they're like, no, no, no. This is alien. I will not touch it. . And then there's the one in the middle who are like, they just, they need to go touch it and see it before they, they, it, it connects. Um, and that's, so that's, that's the, that's the, that's been the, the challenge.
And it keeps being a challenge that, that people just can't believe that it's this easy. And like. I mean the taco is the he he he's to to blame or thanks for a lot of these life and stuff like When he he proposed this thing about being able to app So we, I did, we did all the JBang run and run from UL, like in the early days, I could even, I can even run a tweet, like, so you can go, you have a tweet UL, I can go JBang Twitter, blah, blah, and I could have, I could run a tweet.
Unfortunately, I can't do that anymore because Twitter has locked down. If you don't have JavaScript, you can't run anything that way. But and. But Tago came up with this like, Hey, we, if, if, why can't we do JBang app install, like, like you can do NPM install pip install go install. Why can't we do that for Java?
So, and this is the thing, and this is, again, I'm saying here, and I'm pretty sure no majority of those who are listening will not get it until they try it, but you can now, there's, you can, you can take a JBang script and you can Or a jar or maybe an artifact or anything and install. You can go jbank ev install.
Like the latest one is JLama. JLama is an inference engine for AI. It's a little tool. You just go JBang, app install, JLama and it's a different name. But, and then you have JLama, and you just run JLama directly. You don't see JBang, you don't see Java. It's just there as any CLI. And there's a bunch of these tools out there.
Like there's an SQL line, there's a different utilities that are written in Java, which originally you have to go like download the JDK, download the jar, put it in the past, blah, blah, all that is just gone. You just go javang app install. And, and, and you can do that for any Java. This, like that product has been built with Maven or Gradle or whatever.
And the only thing they use javang for is just to, to wire up all that stuff. And again, if you're a Python guy, a Node. js guy, a Go guy, you've been doing that all day, all year for the last 10 years. And now you can do it for Java, but getting that word out and getting people to believe it has been the biggest challenge.
Jeff: Oh yeah, I, you know, and I, I remember what you taught when you said, you know, it's got to be hard to be enterprise and all that, because I remember back in the early days of the internet. If you didn't compile your own IP stack, you didn't deserve to be on the internet. You know, it was just, it has to be hard or you don't deserve to be here.
But, but going into that, can I use it in enterprise? Is it, you know, is it, is it stable enough? Is it ready to go?
Max: Well, so
Jeff: have a cheap code for enterprise. Yeah. .
Max: Yeah. Well, so the, the, the, yes. So the thing is, and this is related to what I said before, like it, it, it literally is, you don't have to do the scripting part of J Bank.
J Bank scripting was just where it started. But you can use any kind of j jar. So if you have, a spring project or micro naught or corkers or anything else. You can just use J bank to run it, set it up. And one enterprise area we, I, I see, and this is where we actually use it. On the product I have myself is all the CDI, like CI scripts, like the, the, it's so popular, we're doing all this dev ops stuff.
And the fact that our Java developers can just use Java to script things that they do. So that's one entry, but The other product that my main job is actually to work on a product called Quarkus, that's actually the t shirt I have on here is it's this thing where we, we, we, we, it's an enterprise framework stack that makes Java, you know, fun again, so to speak.
And, and, and, and, and can run very effectively. And that one actually, the way Quarkus does that is by doing build time, like doing simple build time. And that normally requires a full build tool. But if you combine that with Quarkus actually has support for JBank. So if you take J bank script and add a Quarkus dependency.
It will actually not just be fetching dependencies, but J bank has support for extension. So Quarkus actually gets invoked to go, Hey, I compiled these source files. Now go your Quarkus thing. And then that output is actually. An enterprise app, right? And that can then use all the stuff Corvus has, like native compilation, running container any camel, CXF, all that enterprise stuff is available to you.
But I do want to put an asterisk on it I'm not telling you to drop all your gradle and maven projects because there's stuff that debank doesn't do that these need to do there's complexities that debank navel will cover but Definitely. You, you, you can, you can use J bank to, to write microservices and, and get up and running.
We, we do it for our, we have a GitHub bot and some applications. They all, they are actually either a caucus app then run by J bank because you can get all the Javas, or it's a script that sets up a few things and just runs. So, so yes, it is enterprise, right? But it has a certain use case, right?
So in that way, it, it, it is there.
Jonathan: Very cool. So I've, I've got to ask like what what's, what's coming down the pike, is there something coming for J Bang that you're excited about?
Max: Well, so my what i've been doing mainly is trying to I go out and I I try and find all these utilities because there's there's a bunch of people who wrote Awesome things that never got into hand of people because it was hard to run these things.
So i'm going I mainly go out and submit small patches Hey, jbang we have this notion of a jbang catalog which sets up the command line or that kind of thing and and make it rumble So that's this That's what I've been doing. But the, the, the, the, the main, so when I then do that, then I might find a thing that they do that I hadn't thought about, and then we do a release.
But, and I'm on release, I think like, like 0. 119 is the one that I think I've done like 250 releases in. For four years now. Right now it's very incommensurate, but I'm trying to get to that one. Oh, but that one, Oh there are some enterprise features around how you manage dependencies that I don't capture.
But otherwise I'll say we are very free to complete in, in being able to do the main mission of what JBang is. So, so, yeah, so. For me, the big thing now is actually to get people aware that this exists and try it out and not try and be scared of it. So it's more of a soft features than the hard features in that sense.
Jonathan: Trying to get to 1. 0, do you feel like Sisyphus rolling the rock up for all of eternity? Is it a Sisyphean effort?
Max: Yes. Well, it's just, the thing is I, the problem is I've, I've made the come back to like make, it's so easy to do releases and like, it's been stable and we actually try. And I think we have one or two glitches where we, we did a mistake.
But it's actually, you can still use the old ones just fine. But one of the things I want to do before the wonder will break some users and That's, that's the rolling I'm, I'm like one day I'll, I'll do it this way. And then they, yeah, so no, so yes, I do fall through that. But I, the, the cool thing I do is this part of the the way we do the current, like the, the installation, whether it's the Maven plugin or greater any, any of the way you install like curl and stuff is is going through J Bang dev a URL so I can actually see When people are running a J bang in stores.
So no, I can't see who you are, but I can just see someone somewhere did fetch this little script to go look at the latest version information. And I can see the growth is there a lot of people in Azure and GitHub Jackson is using it. But I'm still missing the. The uptake in all those Java utilities out there to, to to make, to, to have it and any Java stuff available as easy as you can for Python and, and, and JavaScript.
Jonathan: All right, we're getting close to wrap and here in just a minute, I'm going to ask if there's anything we didn't ask that we should have. While you think about that, I'm going to ask a different question. And that is, what is something that your users have done that really has surprised you? Is there any like oddball use cases that are particularly interesting?
Max: Okay. Well, well, so, so, so the, the, the latest one, it's not all about the JVM, it's just this thing of so, so the, the, the JLAM, I think, so, so again, everyone thinks AI has to be a Python, which is great and stuff, but JLAM Java has a vector 20, there's a, a vector support coming, so they can, it can do efficient array copying and manipulation, which you need to do in inference engine.
So there's a guy Jake, I just know him as Jake on, on, online. His run and written in a Java implementation of that's called JLama. And he had an installation set up that was very complicated. And I just pointed out, Hey, you can do a JBang. And he just did that like this week. So now you can actually, with JBang, again, you can start from scratch on your machine and just install JBang and go JBang download this, one of those models and run it and no, and it will be a CPU, a GPU optimized and that kind of thing on any platform where that exists.
So that, that's my recently interesting setup. Then I know that's, that's gotta be tricky to explain but I'm showing it, but Java has a notion of agents. So you can attack any Java app. You can attest an agent that gets notified by anything gets loaded, and then it can manipulate the classes and you can do evil things or good things.
They can monitor and that kind of thing. And again, if you use the normal Java tool chain, that's a lot of arguments, a lot of setup, and you have to download files and that kind of thing. So we have a product in Rehag called Byteman, which is an agent that can go in and you can say, hey, if I hit a method that has this signature the third time, throw an exception or log a statement, right?
So you can do all kinds of things, but you have to do all these steps. And then I realized in JBang, we have all the pieces to not just go get dependencies, but all of the app, but also the dependency of the agent. And also any configuration that the agent needs, I can go get from a, from a URL. So again, with JBang, you can actually.
Set up any kind of agent usage on any kind of a Java app in a one liner command, no complicated cradle, maven, all that kind of thing. And I find that super interesting, but. I also think many people will actually appreciate it because those who actually managed to do that without it is very, very few, but the, the, the, the, the power is immense.
And this is stuff that you cut like in, in Python or Node. js is those kind of things just doesn't exist or are even more obscure than, than we have here. So no, so the,
Jonathan: Yeah, interesting. All right. Is there anything that we didn't ask about that you really wanted to let folks know about?
Max: Well, the main thing I have is like, if you're listening to this and seeing it, do just try it out and spread the word, like try, try and use it.
And if you have a Java tool to somewhere. Apply a little bit of JBang so it actually becomes available to anyone out there. That, that, that's my, that's my hope that some, some of those people in the, Hey, Java is this horrible, complicated thing. But I know that this utility I actually would like to use if it was easy to use Java.
That's where JBang can help. So, so, yeah.
Jonathan: All right.
Max: Try it out.
Jonathan: Yeah, absolutely. I do have a couple of questions that I'm required to ask everybody. I think I already know the answers. But what is your favorite scripting language and text editor?
Max: So the text editor. So I'm, I use every editor on the planet because I've done tooling it, but the one I, my day to day driver at the moment is VSCode or or some variant of that.
The scripting language, well, I would say Java space script. I, I've done a lot of scripting in my, my like bass and Ruby and Perl and Python, but once I got it working for Java, I use it for everything. But it's technically not a scripted language, but. scripting. So I'll say it counts space. It's my, it's my favorite script.
Jonathan: There you go. All right. I think that's it. We've gone past the hour. We, we sure appreciate you being here, Max. Thanks for stopping by and Telling us a bit about J Bang and scripting with Java. Sounds like fun.
Max: Me too. You should try it. It's, it's, it's not your parents Java anymore. Yeah.
Jonathan: Yeah, I'll have to, I'll have to look it up and give it a shot.
All right. Jeff, what do you think? Have we, have we convinced ourselves to go try some JavaScripting that is not JavaScript?
Jeff: I, you know, I'm kind of interested in this. It's you know, I, I've seen a bunch of Java programming in the past. And, you know, I've, I've messed with other languages, not really with Java, but, you know, kind of something to make it a little easier like that.
I kind of interested in that, you know, I, I, it piques my curiosity.
Jonathan: I, I feel like it would be fun to at least like, fiddle around with it enough to be able to say that you've done so. I, I'm curious. I, I guess I wonder are there things that you normally do in scripting that Java is not made for? And we, we didn't, we ran outta time.
This is one of the questions I, I wanted to ask. We ran out time to do so. But I'm interested to dive into it and see, you know, like in bash scripting you get to do things like, call other bash commands with backticks and then replace the output of that command into your script and Just I I guess Java has all of that built in because it's more of a full featured programming language So it doesn't even need all those tricks But it's interesting.
It'll be fun to play with I definitely need to go grab it and check it out in in possibly a snap format Maybe I don't think I have any computers that'll run snaps actually
Jeff: That's, that's a UL, ULS inside baseball. Yeah, yeah,
Jonathan: yeah, yeah. All right Jeff, thanks for being here. Do you have anything that you want to plug?
Jeff: I don't. I just well, I guess other than check us out on the Untitled Linux show, over on the twit. tv network become a member of Club Twit. And I'll see you next time.
Jonathan: Yeah, have a great week. Excellent. Thank you for being here. I do want to let folks know. First off, next week, we're talking about EMBA with Michael Messner.
And that is an embedded firmware analyzer. I came across this doing the security column on Packaday, which go live, goes live on Friday morning, which you should check out. Came across it one week and it's an open source project doing like embedded firmware analysis, looking for problems, trying to understand the way it works.
And I got to looking at their code and thought it was really cool. And so we're going to have them on the show next week. It's going to be super duper interesting to talk about EMBA. Other things that I want to plug, of course, as Jeff said, we've got the the Untitled Linux Show over at twit. tv.
Would love for everybody to go check that out. Show Twit some love, and yeah, we appreciate Hackaday giving us a home for the show. And with that, we will see you next time on Floss Weekly.