john sayeau wrote: ...I try to compile it with this command:
javac -classpath WEB-INF/classes/com/example/:/usr/tomcat/lib/servlet-api.jar WEB-INF/classes/com/example/MyServletContextListener.java
...
Your Dog class is part of the package com.example, so its qualified name is "com.example.Dog," which is in the directory "classes." That's the directory
you should specify in your classpath.
For reference, see
Understanding the class path and package names.