I've downloaded java jdk1.8.0.7.tar.gz file from the official website and unzipped it into my home directory. Now to set the `$JAVA_HOME` variable I used the follwing commands command `nano .bashrc` and then appending `export $JAVA_HOME=/home/shivam/Java/jdk1.8.0.7` at the end of the file .   

 But whenever I run the command `sudo $CATALINA_HOME/bin/startup.sh` I get an error message saying 

```
Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
At least one of these environment variable is needed to run this program

```

I don't understand why it is unable to find the java path though I've installed tomcat and set its home variable the this way, which worked.  

I wan't to install Java manually **without using** `apt-get`.  
 Kindly guide .