[JAVA] Environment construction for Servlet application development

Overview

I wrote a general flow about the development environment for creating Servlet applications.

environment

OS macOS High Sierra

List of things to install

Eclipse ver.4.8(Photon) I developed it using ver.4.8, but I think it's okay if you use the latest version. https://www.eclipse.org/photon/

Tomcat A container for executing Servlet https://tomcat.apache.org/download-90.cgi

Java I used JDK ver.10, but it seems that it can no longer be downloaded. https://www.oracle.com/technetwork/java/javase/downloads/index.html I wonder if you can use the latest version.

** However, with the Java version installed on the server when uploading to the server Please note that it may not work unless the Java version is matched when developing locally !! (The class file version differs depending on the Java version, and it does not work properly) **

MySQL Necessary if you want to make an application that uses a database If you press [NEXT] with the default settings, you can install normally. https://dev.mysql.com/downloads/mysql/

Project creation

1. Start Eclipse

The location of the workspace is OK as it is unless you are particular about it スクリーンショット 2019-09-22 16.56.07.png

2. Build a tomcat server

Enable tomcat server from eclipse

Add tomcat server

Select [File]-> [New]-> [Other] スクリーンショット 2019-09-22 17.09.49.png

Select Server, then select Next スクリーンショット 2019-09-22 17.11.26.png

Select the version of Tomcat server from [Apache](this time select the latest Tomcat v9.0) Leave the other items as Default and select [Done]

When complete, the Servers item will be added to the Package Explorer location. The server of the selected version of tomcat is running スクリーンショット 2019-09-22 17.15.48.png

3. Project creation

Select [File]-> [New]-> [Project] スクリーンショット 2019-09-22 17.01.51.png

Select ** Dynamic Web Project ** in the Web and select Next スクリーンショット 2019-09-22 17.02.51.png

Enter the project name to be created in the project name input field Change the target runtime version to [Tomcat9 (Java10)] that was set earlier Changed the configuration item to [Tomcat9 (Java10) default configuration] スクリーンショット 2019-09-22 20.52.07.png

When the project creation is completed, the [Project Name] item is created in the location of Package Explorer. スクリーンショット 2019-09-22 20.54.32.png

Create an html file to display something for the time being Right-click on the project name and select New-> Other Select [html file] and create it under [project name / WebContent](example: index.html) スクリーンショット 2019-09-22 20.57.56.png

Changed index.html to feel like ↓

index.html


<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>TITLE!!!</title>
</head>
<body>
Qiita
</body>
</html>

This completes the project creation once

4. Add project to server

At this point, the window related to [Server] does not exist on the screen of Eclipse, so I will add a window. Select [Window]-> [View View]-> [Other] at the top of the screen. スクリーンショット 2019-09-22 17.23.39.png

Select Server, then select Open スクリーンショット 2019-09-22 17.24.46.png

Then, the [Server] window will be added to the top page of Eclipse. Right-click on the server and select Add / Remove スクリーンショット 2019-09-22 17.26.14.png

Here, select the project you created earlier, select [Add], and when you can move to the [Configured] field, select [Finish]. This will register the project on the server and allow it to be launched on the server. スクリーンショット 2019-09-22 17.27.10.png

Select the server to start from the server window and select Start Server スクリーンショット 2019-09-22 21.01.39.png

After confirming that the server is running, launch a suitable browser such as Google Chrome and enter the following URL http://localhost:8080/Qiita/index.html

Then, if the following screen is displayed, it is successful

スクリーンショット 2019-09-22 21.11.12.png

The flow of this communication ** For localhost (on my PC) port 8080 (port used by tomcat) Make a request with Http and the value of index.html included in the Qiita project is returned Display the value on the browser. ** ** It has become a flow such as.

Summary

I set up a development environment on my PC, set up an Apache Tomcat server, and wrote a general flow of accessing from a browser. If possible so far, I think that all I have to do is write the source code.

Recommended Posts

Environment construction for Servlet application development
Web application development environment construction in Java (for inexperienced people)
java development environment construction
[Jakarta EE 8 application development with Gradle] 1. Environment construction
Rails6 development environment construction [Mac]
BEAR application Docker development environment construction example (docker-sync, Mutagen)
Stable development environment construction manual for "Rails6" with "Docker-compose"
Environment construction with Docker for beginners
[Unity] Android development environment construction procedure
[Procedure 1 for beginners] Ruby on Rails: Construction of development environment
Notes for Android application development beginners
Java web application development environment construction with VS Code (struts2)
Build Java development environment (for Mac)
Rails application development environment construction with Docker [Docker, Rails, Puma, Nginx, MySQL]
[Java & SpringBoot] Environment Construction for Mac
Ruby on Rails --From environment construction to simple application development on WSL2
Procedure for building a Rails application development environment with Docker [Rails, MySQL, Docker]
CentOS8 + Anaconda + Django development environment construction procedure
[Processing x Java] Construction of development environment
A memorandum for android application development beginners
Laravel development environment construction with Docker (Mac)
Sapper × Go (echo) × Docker development environment construction
Universal Robotics UR Caps development environment construction
Java development environment construction memo on Mac
[Docker] Development environment construction Rails6 / Ruby2.7 / MySQL8
Spring Boot + Docker Java development environment construction
Java application development environment created in VM environment
[Java] Environment construction
Creating a java web application development environment with docker for mac part1
Java environment construction
Java development environment
[Spring] Environment construction
Docker environment construction
Create a java web application development environment with docker for mac part2
Build a development environment for Docker + Rails6 + Postgresql
Environment construction procedure for using PowerMock with JUnit
List of libraries useful for ios application development
CI / CD practice for beginners --Part1 --Environment construction
[Ubuntu 18.04] Environment construction for using PyTorch with RTX3090
Development environment construction using IntelliJ IDEA + Maven + Tomcat 9
A reminder of Docker and development environment construction
Ruby on Rails development environment construction on M1 Mac
Build a development environment for Docker, java, vscode
Introduction to kotlin for iOS developers ①-Environment construction
Django development environment construction using Docker-compose (personal memorandum)
Wordpress local environment construction & development procedure with Docker
WebSphere Liberty for Windows development environment maintenance procedure
[For beginners] Laravel Docker AWS (EC2) How to easily deploy Web application (PHP) from 0 (free) ②-Docker development environment construction-
Penronse environment construction [Windows]
[Environment construction] Eclipse installation
[Environment construction] Ruby on Rails 5.2 system development environment construction [within 1 hour]
Introduction to Slay the Spire Mod Development (2) Development Environment Construction
[Flutter] Ubuntu 20.04 environment construction
Java development environment memo
Java development environment construction on Mac-JDK Install (2020 preservation version)
Rails Docker environment construction
[Mac] VS Code development environment construction (Java, Gradle, Node.js)
Personal application development diary # 2
TDD study # 1 environment construction & first test-driven development (July 6th, 2020)
[Java] Environment construction procedure for developing struts 1.3 with Eclipse
Circle CI environment construction