SDKMAN! for Java

I always install Node.js through nvm and Python through pyenv. Node.js keeps project dependencies inside the project folders itself and doesn’t clutter the system. Similarly, for Python, there is venv which helps me keep dependencies isolated. But I was not using any such thing for Java development. I always had the latest LTS release of JDK installed globally and used it for everything. This used to work always because Java versions didn’t have to be changed as often as Node.js or Python (between Python 2 and 3). In fact, Java version didn’t have to be changed at all.

But now I have a need to switch between Java 8 and Java 11 as part of my work. And also, I’d like to keep up with new features in new releases of Java. Also, I need to test my software with a couple of JVMs ever since Oracle messed with their support terms for Java sometime in the last year. So in summary, I need to now frequently switch versions / distributions of JDK on my computer. Yeah, there is the alternatives thing for Linux, but I found a neater, open-source solution on the internet. SDKMAN!

SDKMAN! is a pyenv alternative or nvm alternative for Java. Read their install and usage documentation for detailed instructions and their full feature set. Some commands –

  • sdk install java to install the latest stable OpenJDK
  • sdk list java to list all available Java installations (with info on what’s already installed)
  • sdk install java to install Amazon Corretto JDK version 16
  • sdk use java 11.0.11.hs-adpt to switch to OpenJDK 11 for the current shell
  • sdk default java to switch to Amazon Corretto JDK as the default

There is many more features, support for other tools like Ant, Spring Boot and so on. There’s even a .sdkmanrc file that can be added in my project so everyone in my team can stay on the same version. This is a neat little tool that I wish I had found earlier.

Which Language/Framework Should I Use

For quite a long time, whenever I wanted to create a pet project or a POC, the first thing I started with is to decide what programming language or framework I should use. Because for long I’ve believed that JavaScript is suitable for Web UI projects, Java and PHP are good for backends, Python is good for data science things and so on. But now, I’ve come to realise it’s probably the least important thing to consider (only when it comes to pet projects and POCs).

Photo by JC Gellidon on Unsplash

More times than I’d like, I’ve put much effort in researching for this decision, and soon, the moment passes, and I don’t even want to continue with my project anymore. It gets shelved even before I could decide all the details. Yet, I do have to choose a language and most of the times a framework/library to make my work easier. Yes, but the way I decide has become much simpler and straightforward.

Doesn’t matter that much. Unless my project is going to have a life of several years, and is going to be worked on by a team of developers, this decision doesn’t even matter that much. Sometimes even in that case. The biggest example is Facebook which probably demanded super high performance, was initially developed with PHP. When it comes to implementing new ideas, it’s way more important to ship a working prototype than whether you have made the best decisions.

Can be revisited. When I make software, more time is spent on solving the problems that are not language-dependent. In comparison to actually designing and implementing the project, the effort for changing the programming language later is quite low. So, I start the POC, and once I’ve made significant progress, I re-evaluate whether some other language would do this easier/better. Almost always, there is no significant benefit, and even if there is, it’s quite simple to rewrite what I’ve done so far.

Bird in the hand. Instead of thinking what might be best suited for the project, and spending effort learning from scratch, it’s better to get started with what I already know and could make quick progress on the idea. By the time I get a handle on that new tech, my motivation could shift and I risk dropping the project altogether. Whereas, if I have a working material product, no matter how small it is, it would motivate me to invest even more time and effort.

Having said all that, if my project/POC demands I use a certain language or technology, obviously I have no decision to make. For example if my POC is to add a search index function to my project using ElasticSearch, of course I have to learn and use ElasticSearch.

Also, if you are working on a long-life project, which will involve a team of developers working on it, then you have to go through the usual process of making the best choice. But even in those cases, you might have to start with a POC.

So stop worrying about which language or framework or tool you should use. Get started with what you already know and make something.