No matter what version of topology creator for NS2, you need to install java.
Here is Java installation for ubuntu.
Open Terminal & type
sudo apt-get install sun-java6-jdk sun-java6-jre
After finishing installation,
If so, you will see your java version and you can check what version of yours.
How to get topology creator NSG2 ( Network Scenarios Generator) version 2
Topology creator for ns2 (download link)
Put this download file to ns folder
Open terminal and type the following comand and be ready to use.
java -jar NSG2.jar
Other topology creators