0% found this document useful (0 votes)
54 views8 pages

Java EE 6 CDI Examples: Accessible To All SVN, Git or Just Download The Zip

The document provides instructions for downloading and running Java EE 6 CDI examples projects from source control in Eclipse, including downloading the code from Subversion or as a zip file, importing and configuring the projects in Eclipse, installing the Resin application server plugin for Eclipse, and deploying and running the example projects on Resin. The examples are meant to demonstrate CDI functionality and serve as a starting point for developing other applications using Contexts and Dependency Injection in Java EE 6. Requirements include a Java 6 JDK, Maven for building projects, and a Java EE 6 compliant application server like Resin, GlassFish, or JBoss.

Uploaded by

tmpnick
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views8 pages

Java EE 6 CDI Examples: Accessible To All SVN, Git or Just Download The Zip

The document provides instructions for downloading and running Java EE 6 CDI examples projects from source control in Eclipse, including downloading the code from Subversion or as a zip file, importing and configuring the projects in Eclipse, installing the Resin application server plugin for Eclipse, and deploying and running the example projects on Resin. The examples are meant to demonstrate CDI functionality and serve as a starting point for developing other applications using Contexts and Dependency Injection in Java EE 6. Requirements include a Java 6 JDK, Maven for building projects, and a Java EE 6 compliant application server like Resin, GlassFish, or JBoss.

Uploaded by

tmpnick
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Java EE 6 CDI Examples

The first set of samples is based on the samples that ship with Weld, the reference implementation of CDI. This version of the samples include a working Eclipse Java EE IDE project files as well as a simplified maven pom.xml that will work with Maven 2 and Maven 3.

Accessible to all svn, git or just download the zip:


Originally we were hosting the examples on github, but decided that more developers know svn and the developers who know git also know svn so svn was the least common denominator. Alos we support developers who dont know svn, by providing a zip file to download. Not everyone uses svn.

Downloading the code with subversion:

To download the code using svn, use this from the command line: $ svn co http://jee6-cdi.googlecode.com/svn/samples/trunk jee6samples

Downloading the code as a zip file:


To download the code as a zip file click on the following link which will take you to the download page of the project site. Page that contains downloads for samples

Requirements:
You need a Java 6 EE server. Dont worry we explain how to download a lightweight one. The samples should work with Resin, Glassfish, JBoss or any other application server that supports the Java EE 6 Web Profile. You need Java 6 SDK. If you plan on building with maven, then you need maven (it works with maven 2 and maven 3).

Building with maven:

$ cd jee6samples $ cd numberguess $ mvn clean install At this piont you should have a war file that will run in any JEE 6 Web Profile Server container (Resin, JBoss and Glassfish). The war file will be in the ./target director. You can copy this war file to the deployment directory of your server and start it up. You can build login in a similar manner.

Running with Eclipse Java EE IDE:


You can run the examples with Eclipse. We include the jar files you need to build in Eclipse. Then it is just a matter of configuring your server in Eclipse. Dont worry we will walk you through so you can go from download to up and running in less than 15 minutes. The first step is to make sure you have a fairly recent version of Eclipse Java EE IDE.

If you dont have the Java EE IDE from Eclipse, you should download it. As you can see, we used Helios Server Release 2 for this. If you dont have Eclipse go to http://www.eclipse.org/downloads/ and download the Java EE IDE. To import the projects, run the File->Import menu item. Then under General select Existing Projects Into Workspace.

Next select the root directory of the download.

At this point, the candi-jsf-login and the candi-jsf-numberguess projects should be imported into your Eclipse workspace. All that is left is to install a Server, and run them.

Installing and running a server in Eclipse:


You need a server that is Java EE 6 Web profile compliant. You could use Resin, JBoss or Glassfish or a few others. For this example, we will use Resin because it is lightweight and fast and it just works. You can download Resin here:

http://www.caucho.com/download/ This example is using the 4.0.X series. Once you download it, you can configure it in Eclipse, but first you need to install the Resin Plugin for Eclipse WTP. (WTP stands for Web Tools Project and it allows you to use Eclipse with many different sever vendors). Go to the Help->Install New Software menu item. Then click o the Add button. Then enter the Name Caucho (the company that makes Resin) and the Location as http:// caucho.com/eclipse as shown below.

Next from the Tree List Select expand the Caucho Resin Node and Select the Resin Eclipse Feature. Then click the Finish button. You have now installed the Resin plugin for Eclipse. Now to run one of the projects on Resin from Eclipse, you just Right Click the Project and select Run As->Run On Server. The first time you do this you will need to setup a Resin server in Eclipse as follows:

Keep hitting the Next > button until it deploys the application to the server (accept the defaults). You only have to setup Resin once. Subsequent times, it just works. At this point you should have a running application.

You can run and debug this application in Eclipse and you can use it as a template to develop your own application to explore CDI and Java EE 6. Happy coding! Let us know what you think.

Additional References:

You might also like