title: Java is installed, in listing, but execution produces "./java: No such file or directory"
body: <p>I just ran the script below and it fetches and unpacks the JDK into the correct location. Problem is that every <code>java</code> command (as copied to <em>/urs/bin</em>) gives errors. I then double check by going into the JDK install directory by means of <code>cd</code> (I am now in JDK/bin) and type : <code>./java -version</code> and get : <code>./java: No such file or directory</code>, but <code>java</code> is there! <code>ls -l</code> on the JDK shows that all <code>java</code> clients are inside the <em>bin</em>.</p>
  
  <pre><code>#!/bin/bash
  #Author: Yucca Nel http://thejarbar.org
  #Will restart system
  #Modify these variables as needed...
  tempWork=/tmp/work
  locBin=/usr/local/bin
  javaUsrLib=/usr/lib/jvm
  
  sudo mkdir -p $javaUsrLib
  mkdir -p $tempWork
  cd $tempWork
  
  #Update this line to reflect newer versions of JDK...
  wget http://download.oracle.com/otn-pub/java/jdk/7u2-b13/jdk-7u2-linux-i586.tar.gz
  
  #Extract the download
  tar -zxvf $tempWork/*
  
  #Move it to where it can be found...
  
  sudo mv -f $tempWork/jdk1.7* $javaUsrLib/
  
  sudo ln -f -s $javaUsrLib/jdk1.7*/bin/* /usr/bin/
  sudo rm -rf $tempWork
  #Update this line to reflect newer versions of JDK...
  export JAVA_HOME="$javaUsrLib/jdk1.7.0_02"
  
  if ! grep "JAVA_HOME=$javaUsrLib/jdk1.7.0_02" /etc/environment
  then
      echo "JAVA_HOME=$javaUsrLib/jdk1.7.0_02"| sudo tee -a /etc/environment
  fi
  
  sudo /sbin/reboot
  
  exit 0
  </code></pre>
  
  <p>Running <code>ls -l /usr/lib/jvm/jdk1.7.0_02/bin/java</code> gives me : <code>yucca@yucca-VirtualBox:~$ 
  -rwxr-xr-x 1 yucca yucca 5654 2011-11-17 22:38 /usr/lib/jvm/jdk1.7.0_02/bin/java
  </code></p>
  
  <p>also ran: <code>file /usr/lib/jvm/jdk1.7.0_02/bin</code> with an output of :</p>
  
  <pre><code>/usr/lib/jvm/jdk1.7.0_02/bin: directory
  </code></pre>