This tutorial describes how to create, configure, deploy and debug Java EE 7 application using GlassFish 4.0 and IntelliJ IDEA 13.
Create a Java application via
|New Project Wizard|
Before you configure the libraries select an application server where you'd like to deploy your application. If there is no application press
If you'd like to deploy your application to several application servers you can configure them later via
If the application is going to use JSF library, please select the corresponding item in the list. By default the IDE will use the library provided by the application server.
Notice that you can select the library from the list or even have it download and configured automatically.
Now you can select other libraries which you'd like to use in your application: Bean Validation, CDI, JSON Processing, WebSockets, RESTful Web Services (JAX-RS), WebSockets and others.
When you press
To make sure the libraries are configured correctly you can go to
To make sure web descriptor and web resources directory are configured correctly you can go to
These settings will be used to build artifacts.
An artifact is what the IDE will deploy to the application server when you run the application server. To make sure the artifacts are configured correctly you can go to
Here you can change existing artifacts or add new ones.
And finally before we run the application we can go to
A run configuration is what defines how the application server is configured, how to deploy the application, etc.
If you go to
When the run configuration is configured correctly we can run it.
When the application is deployed to the server the IDE will open the page specified in the run configuration.
Additionally to the server-side debugging tools IntelliJ IDEA provides the
|Debug in Browser|
Make sure you have installed the corresponding Chrome extension before using
If the extension is installed the IDE will open the web page in the browser and will warn that it's connected to the IDE.
Now you can see the DOM structure of your page right in the IDE. ANother important feature of the Live Edit is that it can deploy the changes you apply to the page to the server immediately as you type, so you don't even need to refresh the browser.
Try to change something on the page and you'll the browser displays them immediately.
Now let's create some server code and try to debug it.
When the application is running we can use
When we run an application in the debug mode the IDE stops at breakpoints.
Notice that you can specify the way how the application is redeployed on
|. This option is available in the |
One more useful option here is
|On frame deactivation|
In this tutorial we used GlassFish 4.0. However you can easily configure other application servers via