javac does not work in ubuntu terminal
As mentioned by @Blorgbeard you most likely do not have a Java JDK (Java Development Kit) installed. See this web page for more information about the various versions of Java available for Ubuntu.
The following command will install the OpenJDK version of the Java JDK:
apt-get install default-jdk
I have Ubuntu 12.10, with java "1.6.0_27", this command makes javac available:
sudo apt-get install default-jdk
Then compile it like this:
el@apollo:~/retreat3$ javac HelloWorld.java
el@apollo:~/retreat3$ java HelloWorld
Hello, World!