Compiling Java Servlet file to Servlet Class

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

  1. I assume you have configured JDK and now you just want to compile your servlet code.
  2. You should know that you need servlet-api.jar
  3. You should also know that servlet-api.jar is placed under your tomcat folder.
  4. Now let import servlet-api.jar to .bashrc
  5. go to your home folder cd ~
  6. open .bashrc using your fav editor : vi .bashrc
  7. add path (relative to yours) : export CLASSPATH=/home/yusuf/apache-tomcat-7.0.40/lib/servlet-api.jar
  8. Save .bashrc
  9. restart your console shell
  10. run : javac
  11. Done



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s