I have installed java in my CentOS release 5.5 machine using the command yum install java
. But I am unable to compile a class using javac.
Do I need to install any other package?
I have tried to locate the javac
executable but i am unable to locate it.
/usr/bin/java
is linked as follows:
/usr/bin/java
-> /etc/alternatives/java
/etc/alternatives/java
-> /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java
I have seen the following output by yum list installed |grep java
:
java-1.6.0-openjdk.x86_64 1:1.6.0.0-1.16.b17.el5 installed
tzdata-java.x86_64 2011b-1.el5 installed
You installed the Java Runtime Environment (JRE) only, which does not contain
javac
. Forjavac
, you have to install the OpenJDK Development Environment. You can installjava-devel
orjava-1.6.0-openjdk-devel
, which both includejavac
.By the way: you can find out which package provides
javac
with ayum
search, e.g.on more recent releases of CentOS e.g. 6 the command changes to
Another note: using
yum
andopenjdk
is only one possibility to install the JDK. Many people prefer Sun/Oracle's "original" SDK. See How to install Java SDK on CentOS? and links for alternatives.