June 19, 2023

Java on Fedora

I am currently running Fedora 38 on my x86_64 desktop. I have done nothing whatsoever with Java since 2011, and most likely have done a fresh Fedora install since those days. Hence I have whatever Fedora gives a person if he never asked for or thought about java.

Typing "javac" does not work.

I can type "java", and typing "java --version" tells me I have

[tom@trona tom]$ java --version
openjdk 17.0.7 2023-04-18
OpenJDK Runtime Environment (Red_Hat-17.0.7.0.7-4.fc38) (build 17.0.7+7)
OpenJDK 64-Bit Server VM (Red_Hat-17.0.7.0.7-4.fc38) (build 17.0.7+7, mixed mode, sharing)
Some searching tells me that to get javac, I need some flavor of "java-xxxx-openjdk-devel", where "xxxx" is the Java version I want. Looking at what is now available via DNF, I see that I have at least 3 choices:
java-11-openjdk-devel
java-17-openjdk-devel
java-latest-openjdk-devel
At this time "latest" is version 20 -- which is presently the latest version of Java. The question is what will happen if I just install latest, given I have the version 17 JRE. Let's just dive in and fine out:
su
dnf install java-latest-openjdk-devel
Last metadata expiration check: 3:08:38 ago on Mon 19 Jun 2023 02:16:20 PM MST.
Dependencies resolved.
================================================================================
 Package                      Arch   Version                      Repo     Size
================================================================================
Installing:
 java-latest-openjdk-devel    x86_64 1:20.0.1.0.9-8.rolling.fc38  updates 4.9 M
Installing dependencies:
 java-latest-openjdk          x86_64 1:20.0.1.0.9-8.rolling.fc38  updates 426 k
 java-latest-openjdk-headless x86_64 1:20.0.1.0.9-8.rolling.fc38  updates  47 M

Transaction Summary
================================================================================
Install  3 Packages

Total download size: 53 M
Installed size: 231 M
After this, typing "java" gives me 17 -- typing "javac" gives me 20. Which is progress of a sort. It may be possible to use "alternatives" to sort this out. I type:
alternatives --config java
It actually offers me 4 choices (11, 17, 1.8.0, and latest). I select "latest" and get:
java --version
openjdk 20.0.1 2023-04-18
OpenJDK Runtime Environment (Red_Hat-20.0.1.0.9-2.rolling.fc38) (build 20.0.1+9)
OpenJDK 64-Bit Server VM (Red_Hat-20.0.1.0.9-2.rolling.fc38) (build 20.0.1+9, mixed mode, sharing)
This seems promising (and maybe even correct). I could have installed the devel package for 17 instead, but I see no reason not to be on the cutting edge.
Have any comments? Questions? Drop me a line!

Adventures in Computing / tom@mmto.org