I ran namenode -format.This is my output. I tried changing the file permissions chmod 777 hadoop.
I believe this line is the error ERROR namenode.NameNode: java.io
Following steps resolved my problem -
1- sudo su
Enter your password.
2-/usr/local/hadoop/bin/hdfs namenode -format.
This has been done for hadoop2.5 in which "hadoop namenode -format" has beendeprecated hence using "hdfs namenode -format"