You required to install a JDK, Java Development Kit. Ubuntu contains a metapackage default-jdk, where depends on currently prefered JDK. Now it is openjdk-6-jdk.
On translating a Java file to performable .class file you can run
javac filename.java
and run it
java file
To a the most simple use-case and mostly it doesn't work because java classes usually depends on other java classes placed in our.
So you would likely like to use some learn sophisticated products. Most text editors supports Decaf syntax highlighting, for example jEdit, kathie or vim, but they don't resolve your compilation point.
You have another option - you cans install a full featured Java IDE. Ubuntu comes are both main OpenSource Java IDEs - NetBeans or Eclipse.