I am trying to setup my own J2EE SDK but the documentation on Oracle is so confusing. like for example, the instruction says to find a file at a location. I can never find the file. I can't look everywhere because I don't know if i am pulling the right file or if it will break other things. almost every line of instruction needs to be updated. anyone has an updated documentation on how to set up the Environment?
-
And what's your question? – cassiomolin May 16 '17 at 22:45
-
J2EE is ... out of date. Java EE 7, maybe? – scottb May 16 '17 at 23:07
-
Welcome to Stack Overflow. Please read the [guidelines](https://stackoverflow.com/help/mcve) for how to post a Minimal, Complete and Verifiable example of your code in a question. – Toby May 16 '17 at 23:23
2 Answers
J2EE has been renamed to Java EE
When the enterprise Java platform was first introduced, it was called Java 2 Platform, Enterprise Edition, with the abbreviation J2EE.
With the versions of the platform shipped early 2006, the Java name lost the 2, and the dot zero. J2EE 5.0, for example, became Java EE 5.
Ah! Don't call it JEE. It's Java EE.
Java EE 7
At the time of writing, the most recent version is Java EE 7, which includes a range of specifications. The Java EE 7 tutorial will give you more details about those specifications.
The Java EE 7 Samples project available on GitHub will help you to start.
Development environment
To develop Java applications, you first need a JDK.
Then install an IDE of your choice that supports Java EE:
Remember that Java EE is a set of specifications so you will need actual implementations for those specifications. Such implementations are provided by a Java EE container.
Here are a few examples of containers you can use:
Setup the JDK and the Java EE container in your IDE (check your IDE documentation for more details).
Quick words on Web Profile
It is worthwhile to mention that Java EE 6 introduced the Web Profile, which is a subset of the Java EE specification and it's purpose is to allow developers to create more lightweight applications.
Consider starting with it. By the way, the Web Profile is used in the Java EE 7 Samples project mentioned above.
Dependencies
To manage your dependencies, you can use Apache Maven.
For the Web Profile, use:
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
And the following for the Full Profile:
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
These dependencies must use the provided
scope. The Apache Maven documentation explains how the provided
scope works:
This is much like
compile
[dependency scope], but indicates you expect the JDK or a container to provide the dependency at runtime. For example, when building a web application for the Java Enterprise Edition, you would set the dependency on the Servlet API and related Java EE APIs to scope provided because the web container provides those classes. This scope is only available on the compilation and test classpath, and is not transitive.
Here's a pom.xml
that will help you to start:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>my-application</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>7.0</version>
<scope>provided</provided>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.1.0</version>
</plugin>
</plugins>
</build>
</project>

- 124,154
- 35
- 280
- 359
I agree that the online documentation of Java EE 6 and EE 7 does not always cover this subject to the necessary depth. Some dubious issues in EE development are however caused by the first choice of developers to use IDE's like Eclipse (and its derived IDE's) to program and deploy their Java EE applications. Unclear parts like deployment descriptors, and where to store the pertaining files, these are not well-explained. Also this holds for the EE wizards ('setup your own EE project', steps). In more modern IDEs, these issues have been resolved. I advice you to get involved with Netbeans or Intellij before working on Java EE applications. You will find much help there.
If you have worked with Spring beforehand, several aspects are known to you already. What is a webservice, a Rest-endpoint? How can the information to and from a GET
or a POST
call be encoded? (XML versus JSON, or both, as allowed by Java EE). Web-programming is more complex than doing Java SE, also because you need to understand when to use stateless Java beans, a singleton Java bean, the meaning of @Postconstruct
, and several other types of EE annotation (@.......).
The EE implementation of a database is called a persistence unit. It is configured with an .XML file, specifically for each type of persistence unit (i.e., database specific). Also you would want to configure JPA for easy entity storage and retrieval, although an SQL-based JDBC-connection can be the preferred choice instead.
Java EE applications are deployed using an application server like the JBoss Application Server, Payara (successor of Glassfish), or for example Websphere. During deployment ('installation'), the initial code of each statefull/singleton Java-bean is called, i.e. @Postconstruct
. You will find confirmation for these steps in the log files on the application server.

- 135
- 1
- 6