Installing Oracle JDK 17 on openSUSE 15 Leap – A Step‑by‑Step Guide
If you’re running a Java application that only works with Oracle’s JDK 17, this is the place to get it up and running on openSUSE 15 Leap. You’ll learn how to fetch the right RPM, verify its integrity, install it cleanly, and make sure the system knows where to find it.
Why pick Oracle JDK over OpenJDK?
Oracle’s builds come with a few extra goodies that some legacy apps still expect—like the proprietary “Java Web Start” runtime or certain security patches. I’ve seen developers hit a wall when their code throws an “UnsupportedClassVersionError” after switching to the default openSUSE OpenJDK 11 bundle.
Step 1: Grab the RPM from Oracle’s site
cd ~/Downloads curl -L https://download.oracle.com/java/17/latest/jdk-17_linux-x64_bin.rpm --output jdk-17_linux-x64_bin.rpm
Directly downloading from Oracle ensures you’re not chasing an outdated mirror that might be missing critical security patches.
Step 2: Verify the package signature (optional but smart)
rpm -K jdk-17_linux-x64_bin.rpm
If it says “OK”, you’re good. If it warns about a bad signature, stop and fetch again—no one wants a half‑broken JDK.
Step 3: Install the RPM with zypper
sudo zypper install jdk-17_linux-x64_bin.rpm
zypper handles dependencies automatically; Oracle’s JDK is largely self‑contained, but it will still pull in glibc and similar libs if they’re missing.
Step 4: Tell the system where Java lives
sudo update-alternatives --install /usr/bin/java java /opt/jdk-17/bin/java 1 sudo update-alternatives --set java /opt/jdk-17/bin/java
Why this step matters: Without update‑alternatives, your shell will keep pointing at the default OpenJDK, and you’ll be running two JDKs side by side. This clears up any confusion for both you and the apps you run.
Step 5: Export JAVA_HOME for your user
Add this line to ~/.bashrc (or /etc/profile.d/jdk17.sh for system‑wide use):
export JAVA_HOME=/opt/jdk-17 export PATH=$JAVA_HOME/bin:$PATH
Many Java projects look for JAVA_HOME. Setting it prevents those “Could not locate java executable” errors when you run Maven or Gradle.
Step 6: Verify the installation
java -version
You should see something like:
openjdk version "17.0.1" 2021-10-19 LTS OpenJDK Runtime Environment (build 17.0.1+12-LTS) OpenJDK 64‑bit Server VM (build 17.0.1+12-LTS, mixed mode)
If the output mentions “Oracle” instead of “openjdk”, you’re all set.
Common hiccups and quick fixes
- The app still complains about the wrong Java version: double‑check that JAVA_HOME points to /opt/jdk-17 and that you reloaded your shell (source ~/.bashrc) after editing it.
- Package dependency errors: sometimes zypper will refuse because of an older glibc. Running sudo zypper refresh && sudo zypper install jdk-17_linux-x64_bin.rpm usually resolves this.
Give it a go and let the Java world roll.