Monday, 25 June 2012

Setting up jdk path (JAVA_HOME) for Tomcat7 in ubuntu

If you are a newbie like me, you might have the same problem as me when you wanted to start the tomcat7 on ubuntu:
  • no JDK found - please set JAVA_HOME
Make sure the JAVA_HOME is set properly: if issuing "echo $JAVA_HOME" does not show any paths, you should add the following lines to your ~./bashrc (if you want to set it locally ) or if you want to set it globally you should add these to /etc/bash.bashrc :

#Java Environment Variable
export JAVA_HOME
export JRE_HOME
export PATH

Now, normally, after reopening the terminal and issuing "sudo service tomcat7 start" should start the tomcat. But if you see the error above again:

  • no JDK found - please set JAVA_HOME

Just to this: "gksudo gedit /etc/default/tomcat7" and uncomment the line that sets the JAVA_HOME variable:

Now run the tomcat. This should do the trick.
If you are interested in seeing some examples in Java 8, checkout my new blog about Java 8 Examples click on this link: Java 8 Examples