I have installed multiple versions of java on my Linux mint mate 20. I can find the multiple Java versions. But I can't find the multiple javac versions, javac is only present for Java 17.
I have installed all the Java version using
sudo apt-get install openjdk-x-jdk, where x is the the Java version.
This is the log of sudo update-alternatives --config java
There are 3 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
------------------------------------------------------------
0 /usr/lib/jvm/java-17-openjdk-amd64/bin/java 1711 auto mode
1 /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1111 manual mode
* 2 /usr/lib/jvm/java-17-openjdk-amd64/bin/java 1711 manual mode
3 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1081 manual mode
Press <enter> to keep the current choice[*], or type selection number:
This is the log of sudo update-alternatives --config javac
atul@mintMate:~$ sudo update-alternatives --config javac
There is only one alternative in link group javac (providing /usr/bin/javac): /usr/lib/jvm/java-17-openjdk-amd64/bin/javac
Nothing to configure.
atul@mintMate:~$
This is my terminal log
atul@mintMate:~$ java -version
openjdk version "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)
atul@mintMate:~$ javac -version
javac 17.0.1
Is there a way to install or locate javac in the openjdk-amd64/bin/ folder. As I have already tried to look for them manually using the tree command.
CodePudding user response:
Your Java 8 install is only for the Java Runtime Environment (JRE). Therefore, it won't have a Java compiler (javac). The compiler is part of the Java Development Kit (JDK).
Try installing Java 8 JDK: sudo apt-get install openjdk-8-jdk. It is likely that your Java 11 distribution is also a JRE-only install. If you need it, just install it the same way as I showed you for Java 8.
