Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
11 views6 pages

M Java-1

The document is an activity report on the installation of the Tomcat Server for the Advanced Java course at Visvesvaraya Technological University. It outlines the system requirements, prerequisites, installation steps, and includes a simple Java Servlet code example to demonstrate the server's functionality. The report emphasizes the importance of having the Java Development Kit (JDK) installed and provides detailed instructions for verifying the installation of Tomcat.

Uploaded by

mohandasar4
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views6 pages

M Java-1

The document is an activity report on the installation of the Tomcat Server for the Advanced Java course at Visvesvaraya Technological University. It outlines the system requirements, prerequisites, installation steps, and includes a simple Java Servlet code example to demonstrate the server's functionality. The report emphasizes the importance of having the Java Development Kit (JDK) installed and provides detailed instructions for verifying the installation of Tomcat.

Uploaded by

mohandasar4
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

VISVESVARAYA TECHNOLOGICAL UNIVERSITY

BELAGAVI-590018

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING


Activity Report on

“Installation of Tomcat Server”


Advanced Java (BCS613D)
Submitted by
Mr. Mohan B Dasar 2KA22CS021

Under the Guidance of


Mrs. Rajeshwari S.G

SMT.KAMALA AND SRI VENKAPPA M. AGADI


COLLEGE OF ENGINEERING AND TECHNOLOGY
LAXMESHWAR-582116

AY 2024-2025
Advanced Java (BCS613D) 2024-25

Tomcat Server

Introduction

JSP programs are executed by a JSP Virtual Machine that runs on a web server.
Therefore, you'll need to have access to a JSP Virtual Machine to run your JSP program.
Alternatively, you can use an integrated development environment such as JBuilder that has a
built-in JSP Virtual Machine or you can download and install a JSP Virtual Machine. One of
the most popular JSP Virtual Machines is Tomcat, and it is downloadable at no charge from the
Apache web site. Apache is also a popular web server that you can al o download at no cost.
You'll also need to have the Java Development Kit (JDK) installed on your computer, which
you probably installed when you learned Java programming. You can download the JDK at no
charge from the www.sun.com web site.

System Requirements

• Operating System: Windows/Linux/MacOS


• Java Development Kit (JDK):JDK 8 or later
• RAM: Minimum 2 GB
• Disk Space: Minimum 500 MB free space

Pre-requisites

Before installing Tomcat, the following software must be installed:

• Java Development Kit (JDK)


• Downloaded from
[Oracle](https://www.oracle.com/java/technologies/javasedownloads.html ) or
[OpenJDK]( https://jdk.java.net /)
• Environment variable JAVA_HOME set to JDK installation path

Before installing Apache Tomcat, it is essential to ensure that the necessary software and
environment configurations are in place. The most important requirement is the Java
Development Kit (JDK), as Tomcat is a Java-based web server. At a minimum, JDK version 8
is required, though it is recommended to use a more recent Long-Term Support (LTS) version,
such as JDK 11 or JDK 17, for better compatibility and security. The JDK can be downloaded
from the official Oracle website or from the OpenJDK project, depending on user preference
and licensing needs.

Dept.CSE.SKSVMACET,Laxmeshwar Page 1
Advanced Java (BCS613D) 2024-25

Steps to Install:

Here's what you need to do to download and install Tomcat:

1. Connect to jakarta.apache.org.
2. Select Download.
3. Select Binaries to display the Binary Download page.
4. Create a folder from the root directory called tomcat.
5. Download the latest release of jakarta-tomcat.zip to the tomcat folder.
6. Unzip jakarta-tomcat.zip
7. The extraction process should create the following folders in the tomcat
directory
8. Use a text editor such as Notepad and edit the JAVA_HOME variable in the
tomcat.bat file, which is located in the \tomcat\bin folder. Make sure the
JAVA_HOME variable is assigned the path where the JDK is installed on your
computer.
9. Open a DOS window and type \tomcat\bin\tomcat to start Tomcat.
10. Open your browser. Enter http://lQcalhost:8080. The Tomcat home page is
displayed on the screen verifying that Tomcat is running.

Fig 1.1: Apache Tomcat website.

Dept.CSE.SKSVMACET,Laxmeshwar Page 2
Advanced Java (BCS613D) 2024-25

Verify Installation

• Open a web browser and go to: [http://localhost:8080](http://localhost:8080 )


• The Tomcat welcome page should appear.

Fig.1.2: Verification of Installation.

Code:

A simple java Servlet code to run Using Tomcat server

import java.io.*; import


javax.servlet.*; import
javax.servlet.http.*;

public class HelloServlet extends HttpServlet {


public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {

response.setContentType("text/html"); // Set response type to HTML


PrintWriter out = response.getWriter(); // Get the output writer to send data to
client
out.println("<h2>Hello from Tomcat!</h2>"); // Write HTML response
} }

Dept.CSE.SKSVMACET,Laxmeshwar Page 3
Advanced Java (BCS613D) 2024-25

Line-by-Line Explanation
Imports Java input-output classes, mainly used for printing output.

Provides basic interfaces and classes for Servlets.

Provides classes for handling HTTP requests and responses.

• Defines a class called Hello Servlet.


• It extends HttpServlet, meaning it can handle HTTP requests (GET, POST, etc.).

This method is automatically called when the user sends an HTTP GET request (like opening
a URL in a browser).

• It takes HttpServletRequest and HttpServletResponse as arguments.

Tells the browser that the response will be an HTML page.

• Prepares an output stream to send data (HTML in this case) back to the browser.

• Sends an HTML <h2> header to the browser

Output on Browser
When you access the servlet via:

bash
http://localhost:8080/HelloTomcatApp/hello You
will see the following in your web browser:

html
<h2>Hello from Tomcat!</h2>

Dept.CSE.SKSVMACET,Laxmeshwar Page 4
Advanced Java (BCS613D) 2024-25

Demonstration:

Fig.1.3: Gimps of Demonstration.

Dept.CSE.SKSVMACET,Laxmeshwar Page 5

You might also like