Setting Up Development Environment: 2.1.apache Server

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

www.SalmanAdeeb.wixsite.com/DAE-CIT-books www.facebook.

com/Gctpak

Instructor IT Miss.Saba Raza

Chp.02 Setting up Development Environment


2.1.Apache Server:
There are actually two "apache" web servers. Apache is shorthand
for the Apache Software Foundation which is one of the largest if not
the largest free and open source software organizations.

They have two web servers that they have developed. By


nomenclature "Apache" is Apache HTTP Server (sometimes also
called Apache httpd - after the name of the process). The other
"Apache" server is Apache Tomcat - which most people just
call Tomcat.
Apache HTTP Server- It is free Apache Tomcat Server - For
and commercial friendly - no Java Servlets.
licensing fees or costs. Tomcat is an application server
- It will run on pretty much any designed to execute Java servlets
OS (Linux, Windows and MacOS) (Servlet technology is used to
- It is actively maintained create web application ,resides at
server side and generates dynamic
web page)and render web pages
that use Java Server page coding

Apache Tomcat Server properties:


It is Incredibly Lightweight
It is Open-Source
It is Highly Flexible
It Offers an Extra Level Of Security

Installation Process of Apache Tomcat Server:

Before installing tomcat , make sure you have JDK (java development
kit)

www.youtube.com/AdeebTechnologyLab www.facebook.com/Adeeb.Technology.Lab
www.SalmanAdeeb.wixsite.com/DAE-CIT-books www.facebook.com/Gctpak

1-Download latest version from tomcat.apache.org


2- Click on latest version tomcat 9.0 and then follow this link
32-bit/64-bit Windows Service Installer (pgp, sha512)

3- After downloading click the <next button then click <I Agree
<select the type of install<Full<Next<Give path from program
files<jdk<JRE<Next<Finish<installed.

There will be no specific icon for tomcat on your windows becauses it


is only services so you have to press window button +R . Run
command will be open and then write services.msc .All services will
be opened

Now by right click on the service Apache Tomcat 9.0.

go to properties <security<manual<start

you can also search this service from Bin folder. Open tomcat9w.exe

Now you make a simple JSP page to display ‘’Hello World’’.

Program files<<Apache software foundation<<Tomcat


9.0<<webapps<<create here new folder<<save with notepad with
the name of index.jsp<<open with notepad++<<write code now

<%=’’Hello World’’%>

Now you go on localhost8080 and also type the name of your jsp file

For example

Localhost:8080/app1

2.2. IDE (Eclipse / NetBeans)

www.youtube.com/AdeebTechnologyLab www.facebook.com/Adeeb.Technology.Lab
www.SalmanAdeeb.wixsite.com/DAE-CIT-books www.facebook.com/Gctpak

In the Java development community, there are two main Integrated


Development Environments (IDEs): Eclipse, which is associated with
IBM and NetBeans which is a Sun/Oracle environment.

NetBeans is an integrated development environment for Java.


NetBeans allows applications to be developed from a set of modular
software components called modules. NetBeans runs on Microsoft
Windows, macOS, Linux and Solaris.

Eclipse is an integrated development environment(IDE) used


in computer programming, and is the most widely used Java IDE.It
contains a base workspace and an extensible plug-in system for
customizing the environment. Eclipse is written mostly in Java and its
primary use is for developing Java applications, but it may also be
used to develop applications in other programming languages via
plug-ins, including C, C++, COBOL, Fortran,PHP

Installation process of Netbeans:


Step 0: Install JDK
To use NetBeans for Java programming, you need to first install Java
Development Kit (JDK).
Step 1: Download
Download "NetBeans IDE" installer
from http://netbeans.org/downloads/index.html. There are many
"bundles" available. For beginners, choose the 1st entry "Java SE"
(e.g., "netbeans-8.2-javase-windows.exe" 95MB).
Step 2: Run the Installer
Run the downloaded installer.
2.3. The Web Application Directory Structure

A web application typically consists of a structured hierarchy of


directories. Within the web application directory hierarchy, a special
directory named WEB-INF must be created. However, the resources

www.youtube.com/AdeebTechnologyLab www.facebook.com/Adeeb.Technology.Lab
www.SalmanAdeeb.wixsite.com/DAE-CIT-books www.facebook.com/Gctpak

in the WEB-INF directory are visible to servlets and Java classes that
reside within the web application.

In order to run your java web application(servlet,JSP etc) we need


web server. Before running the application you need to package the
resources inside it (servlets, JSP's,xml files etc.) in a standardized way
as shown below.

The Root Directory


The root directory of your web application can have any name. In the
above example the root directory name is mywebapp.
Under the root directory, you can put all files that should be
accessible in your web application.
If you create any subdirectories under the root directory, and place
files in these subdirectories, these will be available by the
subdirectory/file path, in the web application. For instance, if you
create a subdirectory called pages, and put a file register.jsp inside it,
then you could access that file from the outside, via this
URL: http://localhost:8080/mywebapp/pages/index.jsp.

www.youtube.com/AdeebTechnologyLab www.facebook.com/Adeeb.Technology.Lab
www.SalmanAdeeb.wixsite.com/DAE-CIT-books www.facebook.com/Gctpak

The WEB-INF Directory :


The WEB-INF directory is located just below the web app root
directory. This directory is a meta information directory. Files stored
here are not supposed to be accessible from a browser (although
your web app can access them internally, in your code).
Inside the WEB-INF directory there are two important directories
(classes and lib, and one important file (web.xml). These are
described below.
1. web.xml :
The web.xml file contains information about the web application, which is used by the Java
web server / servlet container in order to properly deploy and execute the web application.
For instance, the web.xml contains information about which servlets a web application
should deploy, and what URL's they should be mapped to.

2. classes Directory :
The classes directory contains all compiled Java classes that are part of your web
application. The classes should be located in a directory structure matching their package
structure.

lib folder :
The lib directory contains all JAR files used by your web application. This directory most
often contains any third party libraries that your application is using. You could, however,
also put your own classes into a JAR file, and locate it here, rather than putting those
classes in the classes directory.

What is WAR File?


The WAR file is a standard format for web applications that has specific directories and
specific files. This includes a WEB-INF directory, a WEB-INF/web.xml file used to
describe the application, a WEB-INF/lib directory for JAR files used by the application.

www.youtube.com/AdeebTechnologyLab www.facebook.com/Adeeb.Technology.Lab

You might also like