./standalone.sh: 1: eval: /opt/java/jdk1.7.0_21/bin/java: not found
Someone assist on how to fix the above erro kindly. Am trying to run a ./standalone.sh command in the terminal but am getting the above error.

Dani AI

Generated

That message means the script tried to execute the Java binary at /opt/java/jdk1.7.0_21/bin/java but the kernel couldn't find an executable at that exact path. For the most common causes are a moved/removed JDK, a broken symlink, or the script using a hard‑coded Java location instead of the system java.

Quick checks (run these first):

which java
java -version
readlink -f /opt/java/jdk1.7.0_21/bin/java
file /opt/java/jdk1.7.0_21/bin/java
sudo update-alternatives --config java
  • which / java -version show what the shell actually finds.
  • readlink -f follows any symlink at the exact path the script expects.
  • file reveals whether the file exists and what kind of binary it is.
  • update-alternatives lets you point the system java to an installed JDK.

Fix options, ordered by safety:

  • Point the application to a real JVM: set JAVA_HOME to your installed JDK (many standalone scripts honour it) and run the script.
  • Use your distribution’s JDK (OpenJDK or Oracle packages) and manage /usr/bin/java via update-alternatives. This is preferable to hacking scripts.
  • If you must preserve the original path, create a correct symlink from the actual java to /opt/java/jdk1.7.0_21/bin/java, but only after confirming the target is compatible.

Notes: is right that a broken symlink is a typical culprit; illustrates the alternatives chain; ’s suggestion about putting a JVM on the PATH (or exporting JAVA_HOME) is valid; and ’s point about using a maintained JDK is good security hygiene.

Recommended Answers

All 4 Replies

On my kubuntu system, I get this

$ ls -l /usr/bin/java
lrwxrwxrwx 1 root root 22 mars   5  2014 /usr/bin/java -> /etc/alternatives/java
$ ls -l /etc/alternatives/java
lrwxrwxrwx 1 root root 46 mars   5  2014 /etc/alternatives/java -> /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java

Your java executable may have a different location. You can also try

locate bin/java

Your /usr/bin/java is a link to /opt/java/jdk1.7.0_21/bin/java, but it doesn't exist, or is somewhere else.

Just need to add the path to your enviroment. Using "echo $PATH"
displays you current path. you need to add the path of the script to you env using

PATH=$PATH\:/dir/path ; export PATH

and do upgrade to the latest release from Oracle. 1.8.0_60 as of writing.
1.7.0_79 is the last 1.7 release, mostly security fixes and some minor stuff.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.