title: Use my own classes in a servlet (Java/Tomcat/Linux)
body: <p>For the last 3 days I couldn't find a single answer for this problem. I need to be able to use my own classes in my servlets.</p>
  
  <p>I am pretty sure that my files hierarchy is correct:</p>
  
  <pre><code>|-WEB-INF/
  |---classes/
  |------com/
  |---------myProject/
  |------------user/
  |---------------User.java
  |---------------Location.java
  |---------------Comment.java
  |------------servlet/
  |---------------DoComment.java
  </code></pre>
  
  <p>Since User.java, Location.java and Comment.java are defined in one package as <code>com.myProject.user</code> I know I should go to the main root of the java project and compile them this way:</p>
  
  <pre><code>/var/lib/tomcat6/webapps/ROOT/WEB-INF/classes$ sudo javac com/myProject/user/Location.java
  /var/lib/tomcat6/webapps/ROOT/WEB-INF/classes$ sudo javac com/myProject/user/User.java
  /var/lib/tomcat6/webapps/ROOT/WEB-INF/classes$ sudo javac com/myProject/user/Comment.java
  </code></pre>
  
  <p>However, <code>javac</code> cannot identify the other objects (<code>cannot find symbol</code> error) when I use a classpath in my compilation.</p>
  
  <pre><code>/var/lib/tomcat6/webapps/ROOT/WEB-INF/classes$ sudo javac -cp /usr/share/tomcat6/lib/servlet-api.jar com/myProject/servlet/DoComment.java
  </code></pre>
  
  <p>Please help! </p>