How to Execute Java Servlet

How to Execute Java Servlet

To Execute Java Servlet Program you need following software:

1)      JDK  (Download : http://www.oracle.com/technetwork/java/javase/downloads/index.html )

2)      Tomcat Apache  (Download : https://drive.google.com/file/d/0BxD5bHJ5-iirZHQ5Mzc5SG95dkk/view?usp=sharing )

3)      Editor to Write Program : Notepad++(Download :  http://notepad-plus-plus.org/ )

 

Environment Variable Setup Required

  • PATH to JDK/Bin Folder :
    • My Computer Right Click -> Property
    • Advance System Settings
    • Click Advance Tab
    • Click Environment Variables
    • Edit Path Variable from “System Variables” and Add Path to JDK Bin Folder.

 EnvironmentVariable1

  • CLASSPATH to TomcatApache\lib\servlet-api.jar and TomcatApache\lib\jsp-api.jar
    • My Computer Right Click -> Property
    • Advance System Settings
    • Click Advance Tab
    • Click Environment Variables
    • Add CLASSPATH Variable from “System Variables” and Add Path to Tomcat Apache Lib Folder and jar file
    • Sample Values:
    • C:\Program Files\Apache Software Foundation\Tomcat 7.0\lib\servlet-api.jar;C:\Program Files\Apache Software Foundation\Tomcat 7.0\lib\jsp-api.jar;.

How to Execute Java Servlet

 

Step 1 : Install JDK

Step 2 : Install/Extract Tomcat Apache

Step 3 : Setup Environment Variable.

Step 4 : Compile and Execute your First Servlet Program.

Hello Servlet Program

FilePath : C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\example01\WEB-INF\classes

FileName: ex01.java

FilePath : C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\example01\WEB-INF\

FileName: web.xml

 

FilePath : C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\example01\

FileName: index.jsp

Adarsh Patel

My Self Adarsh Suryakant Patel. Currently I am working as Assistant Professor at Parul Instiute of Engineering and Technology, MCA Department, Limda, Vadodara. Major Responsibility : * Lectures * Organizing Training and Expert Sessions for * Placement and Recruitment * Faculty Representative