I have installed the JDK package using $sudo apt-get install java-1.7.0-openjdk-devel. But now when I am running javac, it is giving the error message "Command not found". I am working from Ubuntu Gnome.


Try this: sudo apt-get install openjdk-7-jdk


You got wrong package installed. The one which you instlled is not for Debian/ubuntu, its for Fedora, Oracle Linux, Red Hat Enterprise Linux, etc. Refer this link on OpenJDK site. Do

sudo apt-get install openjdk-7-jdk

Before running above, I would suggest you delete the wrong package using

sudo apt-get purge java-1.7.0-openjdk-devel

Is javac as compiler part of devel package?!

But thing now is after apt-get install simply make a query with

whereis javac

The directory is shown and then cd to this location of javac and compile there your sourcecode snippets.

Or type correctly for compiling this :

/usr/bin/javac listing-name.java

Linux as usual wants and needs exact names and specific locations.

  • I got it solved by the way suggested by Amit – Aparna k das Oct 10 '15 at 18:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.