Linux: Java Error "No such file or directory" When Running a Scan
Problem
$JAVA_HOME
and $JRE_HOME
paths are pointing towards an invalid location.
$JAVA_HOME
and $JRE_HOME
variables and stores them in the default settings for the Linux OS.
Solution
First we need to determine what Java version is installed and the installation folder location.
-
Open the command line and run the “whereis java” command.
-
You should receive a path similar to:
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.292.b10/jre
.
Now that we know which Java path should be used, we need to change the environment variables that were previously set.
-
Run the command:
vi ~/.bashrc
or~/.bash_profile
or~/.profile
. -
Press "i" for insert mode.
-
Find the line: export
JRE_HOME=<full_path_to_java>
. -
Here you need to change the path to match the newest Java installation, which in this case would be:
JRE_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.292.b10/jre
. -
Once done, press escape to exit insert mode.
-
Write ":x!" to save the changes and quit the editor.
-
Run the command: source
~/.<file_you_edited>
or log off the user from the command line and log back in.
Now Java should be correctly matched to the version used. You need to restart the service for the changes to take effect.