Ubuntu – JAVAC is not in the jdk path but java -version says JDK is installed


When I type javac in the terminal, this is what I get:

The program 'javac' can be found in the following packages:
 * default-jdk
 * ecj
 * gcj-4.6-jdk
 * openjdk-6-jdk
 * gcj-4.5-jdk
 * openjdk-7-jdk
Try: sudo apt-get install <selected package>

I want to try the suggestions from this post:

But I can't find the reference to the javac. I expected to find javac inside /usr/lib/jvm/java-1.7.0-openjdk-amd64/bin but it's not there.

What should I do to get javac working since it's not where it is supposed to be?

This is what I get for java -version:

java version "1.7.0_25"

OpenJDK Runtime Environment (IcedTea 2.3.10) (7u25-2.3.10-1ubuntu0.12.04.2)

OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode)

so I guess JDK is properly installed.

Thanks in advance!

Best Answer

It seems you have installed JRE (Java Runtime Environment) only. javac comes under JDK (Java Development Kit) package.
To install JDK, open terminal and type following command:

sudo apt-get install openjdk-7-jdk.