25 Sep

Installing a virtual host outside of Tomcat 8 webapps

To not have to install websites within tomcatX/webapps do the following. I chose to install connected to localhost.  The name for this site is fileSystem so:

  • create a fileSystem.xml file for this app and place it in %TOMCAT_HOME%\conf\Catalina\localhost
  • the contents of fileSystem.xml is
<Context displayName="fileSystem" 
     reloadable="true" />
  • docBase contains the traditional directory structure
  • stop and start, or reload tomcat
  • the resulting URL is http://localhost:8080/fileSystem
  • to link to servlets within a html page the link is e.g.
7 Feb

Tomcat installation and setup notes


A good link to use – https://www.digitalocean.com/community/tutorials/how-to-install-apache-tomcat-8-on-ubuntu-16-04 However, this installs Tomcat for public exposure.

I chose to install it in my personal account. The primary reason was to put it in a non-sudo directory so it would be easier to work with.  It is running on my personal laptop with no other users. Another reason was I wanted to easily run my Servlet in my local directory for testing and mirroring sites that might use them.

The structure I’m using:


tomcat* (this entire tomcat install)

‘site n’-webapps

‘site n’-docBase

Steps I used

  1. I did create a tomcat group – sudo groupadd tomcat
  2. I did not create a tomcat user and assign its directory above as `useradd` will not create a user using tomcat8
  3. I created private structure – mkdir tomcat ; mkdir tomcat/tomcat8
  4. I installed tomcat into tomcat8 – tar xzvf Downloads/apache-tomcat-8.5.27.tar.gz -C /home/roye/tomcat/tomcat8 –strip-components=1
  5. I changed  the group – chgrp -R tomcat tomcat8
  6. I changed – chmod -R g+r conf  ;  chmod -R g+x conf

Website Structure

docBase    WEB-INF        web.xml  <- configures which servlets are used, welcome pages, security 
                 issues        classes  <- a directory containing the servlets and supporting classes. 
                 This is a root classes must be locate below by their package name
                 e.g. com.cnrepperson.test.TestClass.class
    static_content  <- html, php and other content not associated with the site's
                    configuration or servlets

 Setting up Tomcat for remote debugging using Eclipse

Summarized from https://confluence.sakaiproject.org/display/BOOT/Setting+Up+Tomcat+For+Remote+Debugging

We recommend adding this stuff to your startup script so that you are always running tomcat in debug mode.

  1. Open the startup script in (your_tomcat_home)/bin/startup.sh
  2. Add the following lines at the first blank line in the file (around line 8)
    export JPDA_ADDRESS=8000
    export JPDA_TRANSPORT=dt_socket
  3. Change the execute line at the end to include jpda start
    exec "$PRGDIR"/"$EXECUTABLE" jpda start "$@"
  4. Run the startup script when starting tomcat to run tomcat in debug mode

Setup up Eclipse

copied from http://starredmediasoft.com/tomcat-configure-remote-debugging/ on eclipse do the following steps:

  1. Select project to debug
  2. Choose “Debug configurations..” on Debug menu
  3. On “Remote Java Application” left menu, click “New Launch Configuration” button
  4. On Connection Type, select “Standard (Socket Attach)” combo item
  5. Type on the listening port (on the above tomcat configuration, was 8000)
  6. Click on Debug and start listening
6 Nov

Upgrading to Ubuntu 17.04 – installing Eclipse and Oracle JDK 9

One of the pages to install Eclipse is https://itsfoss.com/install-latest-eclipse-ubuntu/ Unfortunately I wanted re-install in a different directory and the page’s constructions to remove an install came back saying  that Eclipse Java was not installed.

So I did the following steps:

  1. use rm -rf to remove the jdk from the system
  2. re-installed using the above instructions
  3. gedit ~/.local/share/applications/eclipse-java.desktop

eclipse-java.desktop contents:

[Desktop Entry]
Exec=”/home/roye/devTools/eclipse-java/eclipse” %f
Comment=Eclipse Java IDE


Installing Oracle JDK 9 instead of Open-JDK:

  1. sudo nano /etc/profile
  2. . /etc/profile
  3. sudo update-alternatives –install “/usr/bin/java” “java” “/home/roye/jdk-9.0.1/ bin/java” 1
  4. sudo update-alternatives –install “/usr/bin/javac” “javac” “/home/roye/jdk-9.0.1/bin/javac” 1
  5. sudo update-alternatives –install “/usr/bin/javaws” “javaws” “/home/roye/jdk-9.0.1/bin/javaws” 1
  6. sudo update-alternatives –set java /home/roye/jdk-9.0.1/bin/java
  7. sudo update-alternatives –set javac /home/roye/jdk-9.0.1/bin/javac
  8. sudo update-alternatives –set javaws /home/roye/jdk-9.0.1/bin/javaws
  9. java –version

add to  /etc/profile after the last `fi`

export JAVA_HOME
export PATH