Friday, May 18, 2012

No JDK found - please set JAVA_HOME error while starting Apache tomcat in ubuntu

If you have already installed JDK and JRE in your system and encountered this error, then follow below steps.

1) Type sudo gedit ~/.bashrc in the terminal
2) Add export JAVA_HOME=/usr/lib/jvm/java-7-oracle  at the end of the file.  Here the path may vary depending upon your installation.  Open /usr/lib/jvm and check for the folder name and replace accordingly.  It is java-7-oracle in my case. This is nothing but setting up environmental path for java.


Check out if your Apache tomcat is starting.  If the same error encounters again, goto next step

3) Type sudo gedit /etc/default/tomcat6  in the terminal and hit enter.
( Type password if asked ).
4) Search for the word something similar to this JAVA_HOME=/usr/lib/jvm/java-7-oracle
If this line is commented, uncomment it and give the same path which you have given previously in .bashrc file.
5) Save the file and try to start the server again. It works!



If you enjoyed this post, make sure you subscribe to my RSS feed! Comments are encouraged

1 comment:
Write comments
  1. Â Great Work, I really like it, thanks for the wonderful share, Keep posting.

    ReplyDelete