I've been tasked to work on updating a Java program that hasn't been touched for years and I'm running into issues building it using the latest version of Java OpenJDK 14.0.1.7-2 on Centos 7. When I run the $ make all
command to start compiling the Java program I get a /bin/sh: javac: command not found
error message.
I've edited the .bash_profile
file in my home directory and added:
export JAVA_HOME=/usr/lib/jvm/java-14-openjdk-14.0.1.7-2.rolling.el7.x86_64/bin/java
Followed by: $ source .bash_profile
to make the changes take effect and verified using echo $JAVA_HOME
which gives me the expected output, but still no luck.
So far I'm only able to successfully build the program when Java OpenJDK 1.8 is installed along with with the additional javac repository.
Running the alternatives --display javac
I get this on the final line:
Current `best' version is /usr/lib/jvm/java-1.7.0-openjdk 1.7.0.261-2.6.22.2.el7_8.x86_64/bin/javac.
This is strange to me as I have not installed Java OpenJDK V1.7 on my system
Running the alternatives --display java
I get this on the final line:
Current `best' version is /usr/lib/jvm/java-14-openjdk-14.0.1.7-2.rolling.el7.x86_64/bin/java.
Any suggestions on where I'm going wrong would be much appreciated.
alternatives --display java
andalternatives --display javac
in your question. A related question is https://unix.stackexchange.com/q/598351/5132 . – JdeBP Aug 07 '20 at 18:02Current best version is /usr/lib/jvm/java-14-openjdk-14.0.1.7-2.rolling.el7.x86_64/bin/java
which is what I'm expecting as it's the only version of Java I have installed, however with your second command I getCurrent best version is /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.261-2.6.22.2.el7_8.x86_64/bin/javac
which is odd as Java OpenJDK v1.7 was removed from my system using the Yum Extender package manager – user427317 Aug 10 '20 at 08:27java-latest-openjdk
,java-latest-openjdk-devel
andjava-latest-openjdk-headless
installed on my system and all of these packages are referring to the OpenJDK development tools 14 – user427317 Aug 10 '20 at 08:31