Question: I installed tomcat, set variables `CATALINA_HOME=/opt/tomcat and CATALINA_BASE=/opt/tomcat`. in terminal I entered command which java and got response `/usr/bin/java`. So how I understand this is path for JAVA\_HOME. I set it. When I start tomcat in terminal with `$CATALINA_HOME/bin/startup.sh` I get response:

```
Using CATALINA_BASE:   /opt/tomcat
Using CATALINA_HOME:   /opt/tomcat
Using CATALINA_TMPDIR: /opt/tomcat/temp
Using JRE_HOME:        /usr/bin/java
Using CLASSPATH:       /opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar
Tomcat started.

```

But when I check, I see that tomcat wasn't started and in logs I found:

```
/opt/tomcat/bin/catalina.sh: 1: eval: /usr/bin/java/bin/java: not found

```

I suppose,that something wrong with path to java. How can I fix it?
PS everyhing was performed in Ubuntu OS

Answer: 
I think you should point your JRE\_HOME to the directory where your java is installed, not the executable `java` itself. An example would be
`/usr/lib/jvm/java-7-oracle` where that folder will contain the `bin/java` executable...
You can also edit the file `../bin/setclasspath.sh` and have an entry 

```
JAVA_HOME="##path of the java directory##"

```

This will make sure whenever you try to start the tomcat, the `JAVA_HOME` will be enforced.