Blog

Let's create a Web project in Eclipse ~ Tomcat plug-in and Tomcat project

The role of Eclipse Tomcat Plugin

 When you use Eclipse to create Java Web applications, you need to use plug-ins. As such a plug-in, this series describes how to make use of the Eclipse Tomcat Plugin and Pleiades All in One originally included in the Eclipse Tomcat Plugin and Pleiades All in One installed in the Eclipse market last time. Among them, this time I will introduce Eclipse Tomcat Plugin.

 The two plug-ins each specialize in different Web applications. It is important to understand how Java Web application specifications differ. First of all, let's start talking from there.

Java Standard Edition

 There are several versions of the Java language specification, mainly Standard Edition. This version is often referred to as Java SE. Java SE is the specification itself that defines the basic class group, such as String,System,Map and ArrayList. These specifications are developed by the JCP (Java Community process) organization under the management of Oracle, and the latest version at the time of writing is 16.

 According to this specification of Java SE, something is implemented as an actual action, JDK (Java Development Kit). Famous for JDK is the Oracle JDK provided by our Oracle, where commercial use requires a license fee.

 Other companies and organizations, including free pay, including IBM SDK, Amazon Corretto and AdoptOpenJDK, have launched JDK for download.

Enterprise Edition (Edition)

 Taking Java SE as the center, it also adds the version of the specification required for the development of large-scale Web applications as the enterprise version, referred to as EE. EE was the same until version 8, but the name was Java EE, and now it's the name of Jakarta EE.

 After the release of Java EE 8, Oracle handed over the EE organization to the Eclipse Foundation in 2018. The name Java is owned by Oracle as a trademark, so the Eclipse Foundation cannot use this name. Instead, it changes its name to Jakarta. Jakarta EE released Jakarta EE 8, which is fully compatible with Java EE 8, in September 2019, and is now releasing nine versions in December 2020.

 The center of EE is servlet. In other words, when you try to create a Java Web application, only SE, JDK, is impossible, and you need to implement EE.

 It is the application server that implements EE. In other words, the server software used to run the Java Web application will be implemented directly by EE. Famous application servers include WebLogic Server for paid Oracle and WebSphere for IBM. As an open source, there are JBoss released by RedHat and GlassFish of WildFly,Eclipse, the community version of JBoss.

 Then there is the WTP introduced next time by the Eclipse plug-in, which is best suited for creating Web applications that run on these application servers.

The location of Tomcat

 Open source Apache Tomcat is very commonly used as the basis for the execution of Java Web applications and is bundled with Pleiades All in One. Strictly speaking, Tomcat is called a Web container, not an application server. What's going on?

 As long as you call yourself an application server, you must meet all EE specifications in principle. On the other hand, EE, as its name suggests, is a specification for large-scale Web applications, so it is too heavy, too long and useless for small-to medium-sized Web applications. As mentioned earlier, the center of Java's Web application is servlet, so there are many sufficient projects if this servlet is centric and a few convenient specifications meet only a lightweight implementation basis. Tomcat is the best execution basis for these projects.

 Then, the plug-in optimized for creating Web applications running in Tomcat is Eclipse Tomcat Plugin, which will be introduced from now on.

 EclipseでWebプロジェクトを作ってみよう〜TomcatプラグインとTomcatプロジェクト

 Of course, you can also create Web applications for Tomcat through WTP, but because it is originally a plug-in for a heavy application server, there are some areas that are difficult to handle. If you limit the running base to Tomcat, Eclipse Tomcat Plugin can create applications more efficiently. How efficient it is will be explained later.

WAR file configuration and deployment

 At the end of the overview, it's actually a place where you want to get started and create a project, but before another point of project creation, there is a better content. It is the file configuration for the Java Web application.

File configuration for Java Web applications

 The file configuration for the Java Web application has been determined, as shown in figure 1.

 The first folder is the root folder of the application, and the WEB-INF folder is placed directly below it. Folders and files outside of WEB-INF are published to Web in its hierarchical form. Therefore, html files, css files, js files, image files, and so on, all create appropriate subfolders directly below the root folder and store them in them.

 On the other hand, because the WEB-INF folder is not exposed to Web, the file classes required by the application's actions but do not want to be exposed to Web are configured in this folder.

 You need to configure at least the classes folder within its WEB-INF and configure .class files in which .java files have been compiled. If you need additional library classes, place them in the lib folder. In addition, placing the web.xml file is the configuration file for the application and is also placed directly under the WEB-INF folder.

War files and deployment

 This file configuration is not limited to Tomcat, but rather the general specification of the application server, that is, EE. Then, the root folder and archive file of the application, with the extension .war, is called the war file. Therefore, this configuration is also known as the WAR file configuration.

 In addition, running a Java Web application on an application server is called deployment. Then, deployment is usually the process of placing the war file in the appropriate folder on the application server.

Hot Articles

How to Save Websites as PDF on iPhone or PC | Business Insider Japan

How to Save Websites as PDF on iPhone or PC | Business Insider Japan

Sign up for a free e-mail newsletter We'll send you a Business Insider Japan e-mail newsletter at 17:00 on weekdays. Check the terms of use You can save the website as a PDF from various web browsers including Safari on iPhone. Photo: Takuma Imamura Web page suddenly ...

READ MORE READ MORE
Yahoo! News Digitalizing the traditional "small pattern dyeing" pattern Crisis of disappearance, challenge of long-established president

Yahoo! News Digitalizing the traditional "small pattern dyeing" pattern Crisis of disappearance, challenge of long-established president

In the file in front of Mr. Atsushi Tomita, a well-preserved paper pattern is included so that it is not exposed to the air as much as possible. To prepare for digitization and prevent deterioration = Taken by Hiroyuki Kondo on the morning of December 10, 2021 at Tomita Dyeing Crafts in Shinjuku-ku, Tokyo ...

READ MORE READ MORE
 It's okay if you forget to record the news!How to see the famous scenes of the Olympics later on your smartphone

It's okay if you forget to record the news!How to see the famous scenes of the Olympics later on your smartphone

Explaining how to use the archive distribution The Tokyo Olympics attracts attention not only for players' play but also for unique commentary. Even if you miss it even though it became a hot topic, or if you did not record it, you can do it at your favorite timing later ...

READ MORE READ MORE

Related Articles