'Where is 'javac' in java-17-openjdk-amd64?

Win10 WSL 2 over an Ubuntu layer

Ubuntu: lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.3 LTS
Release: 20.04
Codename: focal\

Java: java --version
openjdk 17.0.1 2021-10-19
OpenJDK Runtime Environment (build 17.0.1+12-Ubuntu-120.04)
OpenJDK 64-Bit Server VM (build 17.0.1+12-Ubuntu-120.04, mixed mode, Sharing)

I've successfully installed openjdk 17.0.1, but there is no 'javac' command in bin (such as exists in java-11-openjdk-amd64/bin). There is no javac counterpart in java-17-openjdk-amd64/bin.

I've googled, oogled, and bugled to no great gain. In my experience, this means I'm missing something simple.

Someone please guide me here. What gives? How can I get the 'javac' command in openjdk 17.0.1, or how do I use that SDK to create a class?



Solution 1:[1]

I'm unsure which directions I used to install Open JDK before, but I followed the following instructions to remove and re-install: https://www.linuxcapable.com/how-to-install-openjdk-17-on-ubuntu-20-04/

I now have 'javac' in java-17-openjdk-amd64/bin.

Whew.

Solution 2:[2]

This worked for me

sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk-17/bin/javac" 1

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 VirtualMichael
Solution 2 Mrical Singhal