title: What's the correct way of installing jdk on linux
body: <p>I am running the debian based Crunchbang linux system and i want to install the <strong>Oracle JDK</strong> (not openjdk) on my system.</p>
  
  <p>I've spent some time to google for it, but i was not able to find a clear description of how to install (and configure) it.
  So here are my questions:</p>
  
  <p>WHERE is the correct/best location to install the downloaded JDK? (most people prefer something like <code>usr/lib/jvm</code>. why?</p>
  
  <p>when i have installed the jvm (i.e. copied the content of the <code>jdk&lt;version&gt;.tar.gz</code> file to the chosen location, i have to setup my system to refer to the jdk.</p>
  
  <p>here I can use for example: <code>sudo update-alternatives --install "/usr/bin/java" "java" \
  "/usr/lib/jvm/jdk&lt;version&gt;/bin/java" 1</code>.
  i have to do the same with <code>javac</code> right?</p>
  
  <p>finally i have to set the JAVA_HOME variable by adding the lines:</p>
  
  <pre><code>JAVA_HOME=/usr/lib/jvm/jdk&lt;version&gt;/
  export JAVA_HOME
  </code></pre>
  
  <p>to the <code>.bashrc</code> file.</p>
  
  <p>But the problem: This way i always have to update my alternatives whenever i upgrade my jdk right? How can i solve this?
  Can anybody give a clear description how to install the jdk on linux systems in a clever and correct way?</p>
  
  <p>thank you</p>