Follow the instruction to setup Java on Ubuntu 11.10 from How do I install Java?.
Running following command to install:
sudo apt-get install openjdk-6-jdk
After it succeeded and I typed "java", it prompts me with this error:
The program 'java' can be found in the following packages:
* gcj-4.4-jre-headless
* gcj-4.6-jre-headless
* openjdk-6-jre-headless
* gcj-4.5-jre-headless
* openjdk-7-jre-headless