Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

This tutorial describes how to create, configure, deploy and debug Java EE 7 application using GlassFish 4.0 and IntelliJ IDEA 13.

1. Create new project

Create a Java application via New Project Wizard.

2. Select application server

Before you configure the libraries select an application server where you'd like to deploy your application. If there is no application press New button to configure one.

If you'd like to deploy your application to several application servers you can configure them later via RunEdit Configurations.

3. Select JSF library

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.

4. Configure other libraries

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 Finish the IDE will create the project.

6. Check module dependencies

To make sure the libraries are configured correctly you can go to Project StructureModulesProject Dependencies. Here you can add additional libraries which you'd like to use in your application.

7. Check web settings

To make sure web descriptor and web resources directory are configured correctly you can go to Project StructureFacets. Here you can configure additional descriptors (e.g. specific to application server) and change web resource directories.

These settings will be used to build artifacts.

8. Check configured 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 Project StructureArtifacts.

Here you can change existing artifacts or add new ones.

9. Check run configuration

And finally before we run the application we can go to RunEdit Configurations and make sure the run configuration is correct.

A run configuration is what defines how the application server is configured, how to deploy the application, etc.

10. Check artifacts to deploy

If you go to Deployment tab you'll be able to choose the artifacts to deploy, redeploy and undeploy when you perform the corresponding operations for this run configuration.

11. Run application

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.

12. Live edit

Additionally to the server-side debugging tools IntelliJ IDEA provides the Live edit feature. This feature helps you debug web pages via browser. To start debugging a web page just use Debug in Browser from the context menu on this page.

Make sure you have installed the corresponding Chrome extension before using Live Edit.

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.

13. Create a named bean

Now let's create some server code and try to debug it.

14. Update application

When the application is running we can use Update action via F10 to choose the way how to redeploy the application.

15. Debug application

When we run an application in the debug mode the IDE stops at breakpoints.

15. Update resources on frame deactivation

Notice that you can specify the way how the application is redeployed on UpdateUpdate. This option is available in the Run configuration dialog.

One more useful option here is On frame deactivation, where you can specify what to do when the focus leave the IDE window. For instance you can specify to redeploy resources when you switch from the IDE to the browser. It's helps you redeploy changes to the application server quicker.

16. Configure application servers

In this tutorial we used GlassFish 4.0. However you can easily configure other application servers via SettingsApplication Servers.

  • No labels