bash: /usr/bin/java: cannot execute binary file: Exec format error
step-1 : sudo alternatives --config java
Step-2 : The currently active version is marked with a + sign.
[amit@fedora ~]$ sudo alternatives --config java
[sudo] password for amit:
There are 3 programs which provide 'java'.
Selection Command
-----------------------------------------------
*+ 1 java-11-openjdk.x86_64 (/usr/lib/jvm/java-11-openjdk-11.0.12.0.7-4.fc34.x86_64/bin/java)
2 java-1.8.0-openjdk.x86_64 (/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.302.b08-2.fc34.x86_64/jre/bin/java)
3 /usr/local/java/jdk-17/bin/java
Enter to keep the current selection[+], or type selection number: +1
[amit@fedora ~]$ java --version
openjdk 11.0.12 2021-07-20
OpenJDK Runtime Environment 18.9 (build 11.0.12+7)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.12+7, mixed mode, sharing)
[amit@fedora ~]$