Compile Servlet to Class file
here is how to compile your java servlet file to java servlet class :
let say the java servlet file is MyServlet.java
- I assume you have configured JDK and now you just want to compile your servlet code.
- You should know that you need servlet-api.jar
- You should also know that servlet-api.jar is placed under your tomcat folder.
- Now let import servlet-api.jar to .bashrc
- go to your home folder cd ~
- open .bashrc using your fav editor : vi .bashrc
- add path (relative to yours) : export CLASSPATH=/home/yusuf/apache-tomcat-7.0.40/lib/servlet-api.jar
- Save .bashrc
- restart your console shell
- run : javac MyServlet.java