How Do You Troubleshoot This Error “javac: command not found”?

Problem scenario
You have Java installed. The "java -version" command returns data showing that Java was been installed correctly.  You try to use the javac command to compile a .java file.  You get this error:

-bash: javac: command not found

How do you compile your Java code when javac is not recognized?

Solution
As root, run this command:

apt-get install -y openjdk-7-jdk

You may or may not encounter errors.  These errors may be ignorable.

Leave a comment

Your email address will not be published. Required fields are marked *