190

I have been doing Java SE for some years now and moving on to Java EE. However, I have some trouble understanding some aspects of Java EE.

  1. Is Java EE just a specification? What I mean is: Is EJB Java EE?

  2. Are EJB/Spring different implementations of Java EE?

I am sorry to ask but I have some difficulties to understand what Java EE is.

Could someone explain what Java EE is? And EJB?

catch23
  • 17,519
  • 42
  • 144
  • 217
Frank Zimmer
  • 1,919
  • 3
  • 12
  • 3
  • 2
    Check http://stackoverflow.com/questions/1286019/starting-java-ee-mvc – Kheldar Sep 03 '11 at 18:44
  • 2
    You should cut this question in two questions though, one is a duplicate, the other I think is not answered in the link there. – Kheldar Sep 03 '11 at 18:49
  • 2
    Actually, did you read the [java-ee] [tag wiki](http://meta.stackoverflow.com/posts/66297/revisions)? – Paŭlo Ebermann Sep 03 '11 at 20:32
  • also read: http://stackoverflow.com/questions/106820/what-is-java-ee – claws Dec 12 '12 at 20:19
  • also: [who-implement-the-specification](http://stackoverflow.com/questions/37983860/java-ee-who-implement-the-specification/37985284?noredirect=1#comment63456009_37985284) – jan.supol Jun 28 '16 at 17:44
  • Jakarta EE is the new name for Java EE. – Viraj Mar 07 '18 at 17:02
  • Related: [*Java EE Web Profile vs Java EE Full Platform*](https://stackoverflow.com/q/24239978/642706) – Basil Bourque Mar 25 '18 at 22:54
  • Java EE past, present and future provides context: https://readlearncode.com/java-ee/java-ee-past-present-and-future/ – Alex Theedom Apr 05 '18 at 09:39
  • 1
    well java EE is just like ruby on rails EE or javascript EE chose any language today and just call it EE that it sounds niceer....no other language needs some Marketing buzzwords like enterprise edition just to say hey i can do web and db. "I know java" "wait, you know Java or Java EE" .. WTF its like braging i can do http request in javascript or acces db in rails.. wow magic. but business ppl love the words ENTERPRISE EDITION .... drop the EE Java! – H.R. May 14 '19 at 15:04

6 Answers6

230

(Updated May 2023)

First of all, "Java EE" has since Sep 2019 been renamed to "Jakarta EE", starting with version 8. Historically, there was also the term "J2EE" which covered versions 1.2 until 1.4. The term "Java EE" covered versions 5 until 8. See also Jakarta EE, History on Wikipedia.


Is Jakarta EE just a specification? What I mean is: Is EJB Jakarta EE?

Jakarta EE is indeed an abstract specification. Anybody is open to develop and provide a working implementation of the specification. The concrete implementations are the so-called application servers, like WildFly, TomEE, GlassFish, Liberty, WebLogic, etc. There are also servlet containers which implement only the JSP/Servlet part of the huge Jakarta EE API, such as Tomcat, Jetty, etc.

We, Jakarta EE developers, should write code utilizing the specification (i.e. import only jakarta.* classes in our code instead of implementation specific classes such as org.jboss.wildfly.*, com.sun.glassfish.*, org.apache.tomcat.*, etc) and then we'll be able to run our code on any implementation (thus, on any application server). If you're familiar with JDBC, it's basically the same concept as how JDBC drivers work. See also a.o. In simplest terms, what is a factory?

EJB is part of the Jakarta EE specification. Look, it's in the Jakarta EE API. Full-fledged Jakarta EE application servers support it out the box, but simple JSP/Servlet containers don't.

See also:


Are EJB/Spring different implementations of Jakarta EE?

No, as said, EJB is part of Jakarta EE. Spring is a standalone framework which substitutes and improves many parts of Jakarta EE. Spring doesn't necessarily require Jakarta EE to run. A bare-bones servlet container like Tomcat is already sufficient. Simply put, Spring is a competitor of Jakarta EE. E.g. "Spring" (standalone) competes EJB/JTA, Spring MVC competes Faces/REST/MVC, Spring DI/IoC/AOP competes CDI, Spring Security competes JASPIC/Security, Spring Boot competes MicroProfile, etc.

Back during the old J2EE/EJB2 times, the EJB2 API was terrible to implement and maintain. Spring was then a much better alternative to EJB2. But since EJB3 (Java EE 5), the EJB API was much improved based on lessons learnt from Spring. Since CDI (Java EE 6), there's not really a reason to look at again another framework like Spring to make the developers more easy as to developing among others the service layer.

Only when you're using a bare-bones servlet container such as Tomcat and can't move on to a Jakarta EE server, then Spring is more attractive as it's easier to install Spring on Tomcat. It isn't possible to install e.g. an EJB container on Tomcat without modifying the server itself, you would basically be reinventing TomEE.

See also:

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • 2
    So Java EE could be said as defining what support should exist for a typical JEE application to run? – James P. Sep 03 '11 at 21:49
  • 4
    @James: Yes. Pretty everything in Java EE API is abstract. Java SE API has also several abstract parts, e.g. JDBC, JAXP, JAXB, etc. – BalusC Sep 03 '11 at 22:00
  • 3
    "There's not really a reason to look at again another framework like Spring to make the developers more easy." -> Truly Valuable info. – jacktrades Nov 20 '12 at 12:43
  • @BalusC: Hi, Is the official Sun Java EE.... link is broken, if you give a link similar to that, it will be helpful for someone. – Abdul Rahman Jan 04 '14 at 06:28
  • To run complete Spring framework, Servlet container would suffice, Servlet container is [web server + web container(implements servlet api)] where as to run Java EE, you need application server like Glassfish. Servlet container would not suffice. Servlet container is a subset of application server. How do I understand this? – overexchange Dec 20 '17 at 23:17
  • @overexchange: JSP/Servlet is a subset of Java EE. – BalusC Dec 21 '17 at 07:07
  • Are you saying that, anything written in Spring framework boils down to Servlet? whether it is an MVC application or middle ware? – overexchange Dec 21 '17 at 07:24
  • @overexchange: Nope, rest of Spring is proprietary. – BalusC Dec 21 '17 at 07:29
  • I don't know about the proprietary part, and what that mean? Any resource to read? – overexchange Dec 21 '17 at 08:15
  • @overexchange: It just means that Spring is not Java EE. Like as that a BMW is not a Toyota even though they can drive the same road. If you can't grok that, you'd better take a step back and re-read the entire answer including all of its internal links and the internal links theerof and the internal links thereof and the internal links thereof, etc. – BalusC Dec 21 '17 at 08:33
  • I also think the term proprietary was improper in this context. It usually refers to closedsource implementations (and sometimes too no public API). AFAIK, Spring is opensource and has its own "native" API. – Johan Boulé Mar 07 '19 at 17:35
13

Java Enterprise Edition (Java EE) is an umbrella specification that references a number of other more detailed specifications, of which Enterprise JavaBeans (EJB) is one of the more important ones.

Read this - it explains the difference between Java EE and Spring

Thanks...

Community
  • 1
  • 1
Prabath Siriwardena
  • 5,891
  • 1
  • 27
  • 34
  • Is Java SE also a specification? I find the term edition less confusing. Why not call it an edition of the Java Language as the name already implies? – Mehdi Charife Jun 15 '23 at 04:26
4
  • Source -- Java 2 Platform, Enterprise Edition (J2EE) defines the standard for developing component-based multitier enterprise applications. J2EE simplifies building enterprise applications that are portable, scalable, and that integrate easily with legacy applications and data .

  • Source -- Enterprise JavaBeans (EJB) technology is the server-side component architecture for Java Platform, Enterprise Edition (Java EE). EJB technology enables rapid and simplified development of distributed, transactional, secure and portable applications based on Java technology.

  • Is Java EE just a specification? What I mean is: Is EJB Java EE?

    • Java EE is a specification.

    • EJB is server side component architecture for Java EE

  • Are EJB/Spring different implementations of Java EE?

    • Both EJB and Spring are different frameworks following Java EE.
XoXo
  • 1,560
  • 1
  • 16
  • 35
Srikanth Venkatesh
  • 2,812
  • 1
  • 20
  • 13
  • 6
    It's maybe not very useful to quote ancient text (2005) from an ancient version of the specification (J2EE). OP specifically asked for Java EE, which is the modern day incarnation of J2EE. – Arjan Tijms Sep 04 '11 at 14:11
-1

Everything you need to know about Java EE may be found by starting @ Oracle official website, among other. You may also find interesting to read the specification APIs for release 8. It is worth taking the time to go through the Java EE 8 tutorial. You may want to start with it actually, because it provides a very good overview of the whole platform.

Spyros
  • 339
  • 1
  • 7
-2

J2EE/JEE/Jakarta EE

  • Java Enterprise Edition (JEE) is used to develop distributed application & web services.
  • It’s a component based approach to develop web app.
  • JEE web apps are considered as 3 tiered apps, since it is divided on 3
    different machines/tiers
    • Client (Presentation)
    • J2EE sever (Application/Business)
    • Database (Data Access)
-5

To put simply - JavaEE is a platform.

It is made up of many specifications which are just APIs. The specific concrete implementations of these APIs are the so called 'Reference Implementation'

  1. EJB is just one specification within the JavaEE platform
  2. No, Spring is a application framework that can allow you/has support for you to develop JavaEE applications

EJB is Enterprise Java Beans

SoftwareDeveloper
  • 1,094
  • 2
  • 15
  • 26
  • 4
    This answer doesn't add anything to previous answers. Moreover, it is not accurate: only one concrete implementation is Reference, the others are not. Minor one: Spring integrates with JavaEE, but can work without it just fine. – Tair Sep 06 '15 at 20:13
  • @tair Yes only 1 concrete implementation is regarded as the 'Reference' for e.g. JPA has numerous implementations but only EclipseLink is the RI. When i mentioned RI i was meaning across the different APIs. i think you misunderstood my answer above. Also, yes, Spring integrates with JavaEE which is what i mentioned above. – SoftwareDeveloper Sep 06 '15 at 20:49