# How to set JAVA_HOME in fedora 20

Hi I am trying to set JAVA_HOME in fedora20, but after I installed openjdk via yum, i cannot set it correctly. after I set PATH, when I execute it via $PATH, it return "/usr/bin/java/jdk1.7.0_55: No such file or directory" which is the return directory I get when I run which java edit retag close merge delete ## Comments How did you set the PATH var? ( 2014-05-22 11:16:47 -0500 )edit ## 3 Answers Sort by » oldest newest most voted I still work with F19, but I think nothing has changed in F20. $> export JAVA_HOME="/etc/alternatives/java_sdk"


or

$> export JAVA_HOME="/etc/alternatives/java_sdk_1.7.0"  Watch out: from F21 the default will be java 1.8 (see: Changes/Java8) more ## Comments Thanks guys like I said the problem was that I installed openJDK without openJDK-dev. so it all sorted out. can admin close this question because it is already answered twice 1 by me and the other by kdg1995 ( 2014-05-23 10:39:08 -0500 )edit I needed this for the Amazon ec2-api-tools; this is what worked for that application: export JAVA_HOME='/etc/alternatives/jre_openjdk' Thanks kdg1955 ( 2014-09-11 15:21:47 -0500 )edit Ok thanks kdg1995. I did all that, but the problem with my installation in my case was openjdk 7 does not come with a java compiler edition, I had to download it because when I typed javac, it returned error, but after I downloaded it using yum, it set the whole PATH automatically bu itself. thanks I hope this will work for all having similar problems more ## Comments For those who are wondered that javac is not in openjdk: install package java-1.7.0-openjdk-devel. It was not my choice, and know that there is confusion compared to Oracle java packages; where you have a JRE and a JDK package. JDK stands for Java Development Kit. ( 2014-05-23 08:19:12 -0500 )edit Ideally, you don't have to set JAVA_HOME because openjdk will automatically setup up alternatives. Some applications might still require you to set JAVA_HOME. This is how I have JAVA_HOME setup in my system. nano ~/.bashrc # Java Home export JAVA_HOME=/usr/java/default/ export PATH=$JAVA_HOME/bin:\$PATH


I am using /usr/java/default because that's where I have pointed Oracle JDK to using alternatives. You can set it to hard link like JAVA_HOME=/usr/java/jdk1.7.0_55/.

Source1

Source2

more