Ask Your Question

How to set JAVA_HOME in fedora 20

asked 2014-05-21 18:19:20 -0500

FihlaTV gravatar image

updated 2014-09-28 17:05:54 -0500

mether gravatar image

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 flag offensive close merge delete


How did you set the PATH var?

Ahmad Samir gravatar imageAhmad Samir ( 2014-05-22 11:16:47 -0500 )edit

3 Answers

Sort by ยป oldest newest most voted

answered 2014-05-23 04:33:00 -0500

kdg1955 gravatar image

I still work with F19, but I think nothing has changed in F20.

$> export JAVA_HOME="/etc/alternatives/java_sdk"


$> export JAVA_HOME="/etc/alternatives/java_sdk_1.7.0"

Watch out: from F21 the default will be java 1.8 (see: Changes/Java8)

edit flag offensive delete link more


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

FihlaTV gravatar imageFihlaTV ( 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

todd_dsm gravatar imagetodd_dsm ( 2014-09-11 15:21:47 -0500 )edit

answered 2014-05-23 07:50:12 -0500

FihlaTV gravatar image

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

edit flag offensive delete link more


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.

kdg1955 gravatar imagekdg1955 ( 2014-05-23 08:19:12 -0500 )edit

answered 2014-05-23 09:26:43 -0500

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/.



edit flag offensive delete link more

Question Tools

1 follower


Asked: 2014-05-21 18:19:20 -0500

Seen: 31,737 times

Last updated: May 23 '14