title: Installing Java 1.8 on Ubuntu Linux from Binary
body: <p>Oracle hosts a page on <a href="https://www.java.com/en/download/help/linux_x64_install.xml" rel="nofollow">how to install Java 1.8 from the binary</a></p>
  
  <p>I was able to do the following -</p>
  
  <p>Download the x64 <code>tar.gz</code> on the Oracle Downloads page.</p>
  
  <p>Create my directory and move the file there</p>
  
  <pre><code>sudo mkdir /usr/local/java
  sudo mv ~/Downloads/jdk-8u45-linux-x64.tar.gz .
  </code></pre>
  
  <p>And unpack it </p>
  
  <pre><code>sudo tar zxvf jdk-8u45-linux-x64.tar.gz
  </code></pre>
  
  <p>The binary itself works, because I can call it using the absolute path</p>
  
  <pre><code>&gt; /usr/local/java/jdk1.8.0_45/bin/java -version
  java version "1.8.0_45"
  Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
  Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
  </code></pre>
  
  <p>But I can't call it standalone </p>
  
  <pre><code>&gt; java -version
  The program 'java' can be found in the following packages:
   * default-jre
   * gcj-4.6-jre-headless
   * gcj-4.7-jre-headless
   * openjdk-7-jre-headless
   * openjdk-6-jre-headless
  Try: sudo apt-get install &lt;selected package&gt;
  </code></pre>
  
  <p>Even setting <code>$JAVA_HOME</code> as that directory didn't work. Is there a step I'm missing? Does it need to be added to my <code>$PATH</code>?</p>
  
  <p><strong>Edit:</strong> I'm aware I could probably install java with <code>sudo apt-get install</code>. I ran into some trouble there in that I wasn't able to <code>apt-get update</code> because of some <code>404</code> errors. I'd rather handle that as a separate question/post.</p>
  
  <p>Thanks!</p>