This set of slides introduces the basic concepts of Java development. First, the difference between Java as the programming language and Java as a platform is stated. Then, the different Java platforms are presented, with a particular interest in Java Standard Edition and Java Enterprise Edition. With respect to the latter, the roles and differences between the many JEE containers are discussed.
5. The Java programming language
The Java programming language is a high-level, object-oriented
programming language firstly released in 1995
class App {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}
10. Java pla'orm
The Java pla*orm is a so#ware-only pla*orm that runs on top of
other pla*orms
┌───────────────────────────────────┐
│ Java program │
├───────────────────────────────────┤
│ Java platform │
├───────────────────────────────────┤
│ Host platform │
└───────────────────────────────────┘
11. Java pla'orm
Every Java pla+orm consists of:
• A Java Virtual Machine (JVM)
• A set of applica8on programming interfaces (APIs)
12. Java virtual machine
The Java Virtual Machine (JVM) is an abstract computer that runs
compiled Java programs
┌───────────────────────────────────┐
│ Java program │
├─────────┬─────────────────────────┤
│ API │ │
├─────────┘ Java VM │
│ │
├───────────────────────────────────┤
│ Host platform │
└───────────────────────────────────┘
13. Java virtual machine
The JVM is virtual because it is implemented in so7ware on top of
a real host pla:orm
┌───────────────────────────────────┐
│ Java program │
├─────────┬─────────────────────────┤
│ API │ │
├─────────┘ Java VM │
│ │
├───────────────────────────────────┤
│ Host platform │
└───────────────────────────────────┘
31. JEE specifica+on
Namely, JEE is an umbrella specifica.on that references a number
of other more detailed specifica9on
┌──────────────────────────────────────────────┐
│ ┌──────────────┐ │
│ │ EJB │ │
│ ┌─────────────┐ │Specification │ │
│ │ Servlet │ └──────────────┘ │
│ │Specification│ │
│ └─────────────┘ ┌─────────────┐ │
│ │ JPA │ │
│ ┌─────────────┐ │Specification│ │
│ │ JSP │ └─────────────┘ │
│ │Specification│ │
│ └─────────────┘ │
└──────────────────────────────────────────────┘
JEE specification
32. JEE implementa,ons
Vendors and open source projects are free to implement one or
more JEE APIs
┌──────────────────────────────────────────────┐
│ ┌──────────────┐ │
│ │ EJB │ │
│ ┌─────────────┐ │Specification │ │
│ │ Servlet │ └──────────────┘ │
│ │Specification│ │
│ └─────────────┘ ┌─────────────┐ │
│ │ JPA │ │
│ ┌─────────────┐ │Specification│ │
│ │ JSP │ └─────────────┘ │
│ │Specification│ │
│ └─────────────┘ │
└──────────────────────────────────────────────┘
JEE specification
33. JEE implementa,ons
"Apache Tomcat 8.0 implements the Servlet 3.1 and JavaServer Pages
2.3 specifica?ons"
(Apache Tomcat 8.0 documenta3on)
34. JEE implementa,ons
"In addi(on to its own "na(ve" API, Hibernate is also an
implementa(on of the Java Persistence API (JPA) specifica(on"
(Hibernate ORM)
38. JEE Components
You may already know a par0cular JEE component: servlets
public class MyServlet extends HttpServlet {
public void doGet(HttpServletRequest request,
HttpServletResponse response);
public void doPost(HttpServletRequest request,
HttpServletResponse response);
public void init();
public void destroy();
}
39. JEE Components
There exist different types of JEE components
• Web components
• Business components
• Applica3on client components
44. JEE Containers
A container provides certain services to the components it hosts,
such as:
• Life-cycle management
• Dependency injec4on
• Concurrency
54. The role of EJBs
In a JEE applica+on, EJBs encapsulate the business logic
@Stateless
public class FlightServiceBean {
List<SpecialDeal> getSpecialDeals() { ... }
List<Flight> findFlights(String queryString) { ... }
}
55. The role of EJBs
Moreover, the EJB container provides fundamental services such as
security and transac+ons
@Stateless
@TransactionManagement(TransactionManagementType.CONTAINER)
public class FlightServiceBean {
List<SpecialDeal> getSpecialDeals() { ... }
List<Flight> findFlights(String queryString) { ... }
}
56. The role of EJBs
Thanks to this, developers are free to focus of defining and
implemen6ng the business logic
57. JEE stack
However, many vendors and open source projects implement only
a subset of the JEE specifica;on
65. References
• Antonio Goncalves, Beginning Java EE 7, Apress Publica:ons
• Chris Richardson, POJOs in Ac:on, Manning Publica:ons
• D, Panda, R. Rahman, D. Lane, EJB3 In Ac:on, Manning
Publica:ons
• Oracle, GeGng Started
66. References
• Bill Venners, The lean, mean, virtual machine
• Oracle, Java EE 7 Tutorial
• Wikipedia, Java EE