Starting J2EE App with Eclipse IDE

When we are talking about the J2EE Application it can be Enterprise application, EJB and web application etc.

In this post we will try to see how to create Enterprise application and include a web application.

First Step:

  • Download Eclipse which support J2EE application.
  • Extract the download zip file and double click eclipse.exe file for more details please visit my earlier post.
  • Create a new EAR project.  Right click your Project explorer >> New >> Project, we will a New project wizard and now extract Java EE and select Enterprise Application Project.

  • Select Next and provide Project name as FirstEAR so once we type the project below we will Location generated by default.
  • Note: If we need to change the location of the project we need to uncheck the checkbox of Use default Location.
  • Next action is select Target runtime.  This would be more crucial for developing your entire project.  Target Runtime is a selection process of the you Middleware server like WebSphere, Weblogic, JBOSS, Tomcat etc.
  • It is purely up to the audience to choose their own server type.
  • To choose Target runtime select drop down if it shows null then select New Runtime button.

  • If we have any Middleware applications installed on our machine then selects them and click next button or else select Download additional server adapters link on top right corner on New Server Runtime Environment wizard.

  • We will new Install New Extension wizard there which will load multiple server list details.
  •  Select any one of them, in my case I select Oracle Weblogic Server as I had Oracle Weblogic server installed in my environment.
  •  Once selected list click Next button, accept the license and select finish to download the server plugin to the eclipse.

  • Once select finish it will check for usage update upload.

  • Select upload now option which is also default one and select Next button it will check for acceptance and select it and click finish it will download your plugin pack to the Eclipse.
  •  Note: Once we done this activity we required to restart the Eclipse so that we are able to get those plugin.
  •  In our case I am selecting Oracle weblogic Server 10gR3 which is also called WLS 10.3.0 once we select the target select Next to provide your configuration details about the server and Java details.
  •  Once I select my Target Runtime correct I will see auto upgrade of EAR version and Configuration.

  • Select Next to list any J2ee Module dependencies and please enable the check box called Generate application.xml deployment descriptor which will use to create set of DD files once your EAR file is generated and press finish.

  • This will create our ear called FirstEAR file let see how it looks in the project explorer.

Step Two

  • Now we need to create Web Application.
  • Select right click on Project explorer and select New >> Projects which will gives us New Project wizard option.
  • Now select Web which will give Dynamic Web Project / Static Web Project option.
  • Note: Static Web Project is only used for HTML and JAVA Script and css but no jsp pages and servlets.
  • So Now we select Dynamic Web Project.

  • After selecting Dynamic Web Project click Next and we will see Dynamic Web Project wizard.
  • We select Web project name as FirstWeb and Target Runtime will be oracle Weblogic Server 10.3.
  • It will also select Dynamic Web Module version in our case it select 2.5 which is latest version for any Web application.
  • Under EAR membership enable check box of Add project to an EAR.
  • We can select current created EAR or else we can select New Project to select different EAR project.
  • Once we are ready by select EAR membership project click Next  button.

  • Next wizard is for creating new package classes folder if we required we can select Add folder or else click Next again.
  • After that it will provide Web Module configuration wizard like Context root / content directory which also include option to generate DD file like web.xml file

  • If we need to change the context root then we can change  we set as default and select Finish button to create a Web Module in Eclipse.

  • So this is the way to create simple EAR and Web Module using eclipse.

Post a Comment