1.1 Jakarta EE Overview
As we mentioned early, Java web, or formally Java web profile, is a subset of the full profile in Jakarta Enterprise Edition (Jakarta EE). To understand what exactly EE is, let's revisit Java Standard Edition (Java SE) firstly.
Here is a simple Java SE code snippet:
public class JavaSEHello {
public static void main(String args[]) {
System.out.println("Hello World");
}
}
Clearly, when this program is executed in your own computer, you are the only user of it. Suppose you are
building a system for a large business organization (e,g., a bank), and you must extend the program to support concurrent users, say more than 10 thousand people, as shown in Figure 1.2. Because those people are often geographically dispersed, the extended program should be a network application. To distinguish from the simple applications, such complex application is called enterprise application, and Jakarta EE is designed for developing it under the guidance of the Java Community Process (JCP). Typical contexts in which Jakarta EE runtimes are used include e-commerce, accounting, and banking information systems.
Generally speaking, enterprise applications also often provide the following features:
- Support for synchronous and asynchronous communication using different protocols.
- Ability to handle transactional workloads that coordinate between data repositories such as queues and databases.
- Support for scalability to handle future growth.
- A resilient and distributed platform to ensure high availability.
- Support for highly secure access control for different types of users.
- Ability to integrate with back-end systems and web services.
You must feel puzzled and even drowsy while reading those arcane words. There is no panic, and please be relaxed. What you need to know is that Jakarta EE can empower you to build a large scale system as complex as Taobao.com
.
From Java to Jakarta
At the birth of Java, there was not concept of EE. In 1999, J2EE was broken out from standard JDK, and it was renamed to Java EE in 2006. Java EE 8 was released in 2017, and it is the last version of Java EE. On September 12, 2017, Oracle Corporation announced that it would submit Java EE to the Eclipse Foundation, and Java EE was renamed to Jakarta EE due to the copyright issue. Note that Jakarta EE 8 essentially equals to Java EE 8 since they have the same functionalities, and the latest version is Jakarta EE 9.
[!NOTE] Geographically, Java is a volcano-dotted island of Indonesia, while Jakarta is the capital and largest city of Indonesia. See the map of Indonesia.
Myths about Jakarta EE
Many beginners may have some myths with respect to Java SE and Java EE.
- Is Jakarta EE more advanced compared to Java SE?
No. Although Java SE is a prerequisite when learning Jakarta EE, it makes no sense to say one is more advanced than another. It is true that the Jakarta EE platform is built on top of the Java SE platform, but can you claim that cola is more advanced than water? Please meditate the analogy in Figure 1.3.
- Is Jakarta EE a new programming language?
No. When most people think of the Java programming language, they think of the Java SE application programming interface (API)[1]. As for common developers, the difference between them mainly lies on API, and Jakarta EE provides more functionalities than Java SE. In short, all code written on Java SE is still valid on Jakarta EE, and they are indeed using the same programming language (i.e., Java)[2].
Jakarta EE full profile and web profile
[!TIP] TL;DR Jakarta EE web profile, as its name implies, handles web related stuff, and it is a subset of Jakarta EE full profile. A Jakarta EE program has to be within a container.
One important thing to know is that Jakarta EE is a set of specifications. Broadly speaking, a specification describe a system in an abstract way by defining APIs and their interactions, and it leaves detailed implementations to vendors. To put it in another way, a specification tells what to do, while vendors care about how to do, and they must meet certain conformance requirements in order to declare their products as Jakarta EE compliant.
Jakarta EE includes several specifications that serve different purposes, like generating web pages, reading and writing from a database in a transactional way, managing distributed queues. Jakarta EE profile represents a configuration of the platform suited to a particular class of applications. A product may implement two or more Jakarta EE profiles, or the full platform and one or more Jakarta EE profiles, as long as their combined requirements do not give rise to conflicts. In this book, we will focus on a subset of web profile, which is targeted at developers of modern web applications.
The Jakarta EE application cannot execute out of thin air, and it has to run within some runtime, just like water drop should be put in a bottle. In Jakarta EE's terminologies, such referencing runtime is called container. As for Jakarta EE web profile, not surprisingly, the specific subset one is web container, and there are abundant products available as the referencing runtimes, such as GlassFish, JBoss, Tomcat, and Open Liberty.
A note for version
It is worth mentioning that many people still like to use the term Java EE instead of Jakarta EE in their writings and speakings, and we would also use Java EE consistently throughout this book if the context is clear.
As we have mentioned, Java EE has been renamed to Jakarta EE, but the documentation of Jakarta EE is not complete yet in the year of 2021, and this would pose many burdens to beginners. Therefore, we still use Java EE 8
throughout this textbook. As for the container, we choose the lightweight Tomcat[4], which is only servlet container (i.e., web-profile only) and does not support Java EE features like EJB, JMS etc.
[1] If you have some trouble understanding API, it is fine that you can simply replace it with "something that helps you program" in your mind. ArrayList
can help you manage a list of items, so it is an API of Java; size()
method can help you determine the length of an ArrayList
, so it is an API of ArrayList
.
[2] There are other alternative JVM programming languages, such as Kotlin, Scala and Groovy for Java EE.
[3] The Java (SE) logo depicts a blue coffee cup with red steam above it, while Jakarta EE logo prominently features a tri-colored boat. Do you know who the Java mascot is? See more at OpenJDK Wiki.
[4] Don't get confused with Tomcat EE
, which is a certified Java EE container, this supports all Java EE technologies.