You are still seeing the same error, which means either Java 8 is not installed, or the script is not finding it. Let’s walk through the solution step by step:
Step 1: Install Java 8
For Ubuntu/Debian:
sudo apt update
sudo apt install openjdk-8-jre
For Fedora:
sudo dnf install java-1.8.0-openjdk
For CentOS/RHEL:
sudo yum install java-1.8.0-openjdk
Step 2: Find the Java 8 Installation Path
Run:
update-alternatives --list java
or
readlink -f $(which java)
Look for a path that includes java-8-openjdk or similar, such as:
/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
The JAVA HOME directory is usually one level up from bin, for example:
/usr/lib/jvm/java-8-openjdk-amd64/jre
or
/usr/lib/jvm/java-8-openjdk-amd64
Step 3: Set the INSTALL4J_JAVA_HOME Variable
In your terminal, set the variable and run your script in the same session:
export INSTALL4J_JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/jre
./filename.sh
(Replace the path with your actual Java 8 path if it’s different.)
Step 4: (Optional) Make it Permanent
If you want this variable to be set every time, add the export line to your ~/.bashrc or ~/.profile file.
If You Still Get the Error
-
Double-check that Java 8 is installed:
java -version
It should say something like openjdk version "1.8.0_xxx".
-
Double-check the path you set for INSTALL4J_JAVA_HOME is correct and points to the Java 8 directory.
If you’re still stuck, please copy and paste the output of:
java -version
ls /usr/lib/jvm/
and I’ll help you further!