JAVA_HOME is not defined correctly

Solution 1:

JAVA_HOME should be set to the name of the directory that contains the bin directory that contains the Java executables (in particular, java itself).

Assuming you do have a /usr/lib/jvm/jdk1.7.0 directory, it probably contains a jre subdirectory that contains the bin directory that contains java and related executables.

So you should probably be setting JAVA_HOME to /usr/lib/jvm/jdk1.7.0/jre rather than /usr/lib/jvm/jdk1.7.0.