title: Set PATH and JAVA_HOME in Fedora 25
body: <p>Please excuse what appears to be a question answered before, but if I read 10 different posts I find 20 different responses.</p>
  
  <p>I just installed Fedora 25.  I am going to be learning Java development and need to set up my environment.  I will be using openjdk and have installed java-1.8.0-openjdk-devel.  I will also be using Maven.</p>
  
  <p>Now I need to set my <code>$PATH</code> and <code>$JAVA_HOME</code> variables.</p>
  
  <p>I tried the answer found here (<a href="https://stackoverflow.com/questions/24102816/fedora-openjdk-set-java-home">Fedora OpenJDK Set JAVA_HOME</a>) </p>
  
  <p>but after adding to my .bashrc</p>
  
  <pre><code>export JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::")
  </code></pre>
  
  <p>and then testing, I get what appears to me to be the wrong answer because I do not think there should be a /jre/ on the end</p>
  
  <pre><code>&gt; echo $JAVA_HOME
  /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.121-1.b14.fc25.x86_64/jre/
  </code></pre>
  
  <p>So can I please ask what I should set JAVA_HOME to so that I do not need to update it with every openjdk update?  </p>
  
  <p>After that I think PATH is just</p>
  
  <pre><code>export PATH=$JAVA_HOME/bin:$PATH
  </code></pre>
  
  <p>this seems like such a straightforward thing to do yet it seems to me there is much confusion.  thx</p>
  
  <p>PS
  also, is .bashrc even the correct place? because I see here (<a href="https://askubuntu.com/questions/175514/how-to-set-java-home-for-java">https://askubuntu.com/questions/175514/how-to-set-java-home-for-java</a>) that /etc/environment would be more appropriate)  thx</p>