0

I am getting the error message below when I run javac on ubuntu terminal:

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

While Java -version is working.

How to resolve this?

jobin
  • 27,708
Vickal
  • 101
  • 1
    It tells you exactly what to do. Try sudo apt-get install openjdk-7-jdk or whatever version of the JDK you want. – Nattgew May 18 '14 at 04:55

1 Answers1

0

You are probably having jre installed, since java -version is working. You will be able to execute java class programs with java. However, to compile java programs, you will need jdk, as Nattgew suggested. You can install openjdk from the software center or from the terminal using:

sudo apt-get install openjdk-7-jdk

or if you need Oracle's jdk, see this question:

jobin
  • 27,708
  • @Vickal: Consider accepting the answer(clicking on the check mark besides the answer) if it has helped you. – jobin May 18 '14 at 10:14