Setting Up Java 21 and Maven
So I’ve been putting off this Spring Boot project for ages, and today I finally decided to get my environment ready. Looking at my GitHub repos, you’d probably think I’m a Python developer (and honestly, I have been doing a lot with Python lately), but my day job is actually Java development.
Weirdly enough, I haven’t set up a proper Java environment on this Linux machine yet. I figured I’d document the process since the default apt packages for this stuff are ancient, and I specifically wanted Oracle’s JDK instead of OpenJDK for this project.
Getting Java 21 Installed
First up is Java. I wanted Oracle’s JDK 21 since that’s what I’m using at work. Thankfully, Oracle makes this pretty easy these days - just grab the .deb file and install it:
|
|
Nice! Java 21 is installed and ready to go. Remember when installing Java used to be a nightmare of environment variables and path settings? Those were the days…
Getting Maven Going
Next up is Maven. I checked the version in the default repositories, and oof - way too old for what I need. Instead, let’s grab the latest directly from Apache:
|
|
This drops Maven into the /opt
directory, but it’s not on my PATH yet. I need to add a couple lines to my .bashrc
file:
|
|
Then I’ll reload my profile to make the changes take effect:
|
|
Let’s check if everything’s working:
|
|
Perfect! Maven is using the right Java version, and I’m finally ready to start coding that project I’ve been thinking about for months. Now I just need to find that Spring Boot tutorial I bookmarked…
…wait, where did I put that link?