Java development on openSUSE or SUSE Linux Enterprise Server (SLES) needs an OpenJDK development package with a matching compiler and runtime. zypper installs the Java Development Kit (JDK) from distribution repositories; checking the selected tools confirms which release compiles and runs source files.

The development package name includes the Java feature release, such as java-21-openjdk-devel. Installing that package also pulls in the matching runtime packages, so the compiler and the runtime come from the same release.

Package visibility depends on the repositories already enabled on the host. If a required JDK release does not appear in the zypper search output, enable the appropriate SUSE product or update repository first, or choose one of the listed OpenJDK development packages instead of adding an unreviewed community repository.

Steps to install OpenJDK on openSUSE and SLES:

  1. Refresh the enabled zypper repositories.
    $ sudo zypper refresh
    ##### snipped #####
    All repositories have been refreshed.
  2. Search for available OpenJDK development packages.
    $ zypper search openjdk-devel
    Loading repository data...
    Reading installed packages...
    
    S  | Name                     | Summary                            | Type
    ---+--------------------------+------------------------------------+--------
       | java-1_8_0-openjdk-devel | OpenJDK 8 Development Environment  | package
       | java-11-openjdk-devel    | OpenJDK 11 Development Environment | package
       | java-17-openjdk-devel    | OpenJDK 17 Development Environment | package
       | java-21-openjdk-devel    | OpenJDK 21 Development Environment | package
       | java-25-openjdk-devel    | OpenJDK 25 Development Environment | package
       | java-26-openjdk-devel    | OpenJDK 26 Development Environment | package

    On SLES, use the package names that appear after the system is registered and its required modules or product repositories are enabled.

  3. Install the required JDK development package.
    $ sudo zypper install java-21-openjdk-devel

    Replace java-21-openjdk-devel with another package from the search output when a project requires a different JDK release.

  4. Verify the JDK compiler.
    $ javac -version
    javac 21.0.13
  5. Verify the matching Java runtime.
    $ java -version
    openjdk version "21.0.13" 2026-10-20
    OpenJDK Runtime Environment (build 21.0.13+9-suse-01699-aarch64)
    OpenJDK 64-Bit Server VM (build 21.0.13+9-suse-01699-aarch64, mixed mode, sharing)

    Both tools should report the same feature release, 21 here. A higher release that is already installed stays the default, so if java or javac reports it instead, run export PATH=/usr/lib64/jvm/java-21-openjdk/bin:$PATH to use OpenJDK 21 in the current shell.

Share this guide