We will create a project of the Dynamic Web type for which we will define a new runtime. We will specify the version and location of our recently installed Apache Tomcat. We will also specify the version and location of our JRE. Finally, we will configure the section dedicated to Java and the Web module.
prd5Ch14
in the Project Name textbox and click on the New Runtime () button.
[TOMCAT_HOME]
.java-7-oracle
.java-7-oracle
is not available, we will need to do the following:/usr/lib/jvm/java-7-oracle/jre
while on Windows the usual location is C:Program FilesJavajdk1.7.0_04
. For JRE name, we will put java-7-oracle
.With the previous steps, we complete the configuration of our server:
We will leave the default configuration as it is and click on the Next > button.
prdweb
and check the Generate web.xml deployment descriptor option as shown in the following screenshot:
Context root will be the name of the web application. Later on we will see that to access it, we will need to use this name in addition to the URL previously used to test Tomcat, that is, http://localhost:8080/
prdweb.
We created a Dynamic Web type project, specified its name, and created a new runtime. We chose Apache Tomcat v7.0
and indicated its location. As the JRE version to be used, we selected java-7-oracle
. For the Java configuration, we used the default values, and when it was time to configure the web module, we modified its context root with the value prdweb
.
Once we have completed the wizard, we will obtain a base environment for a Java website that is configured and working. The environment is configured by default on the Java EE Perspective:
One of the basic concepts in Eclipse usage is that of Perspectives. A Perspective is a combination of Views and Editors thought out to perform a concrete task in an easy and intuitive way.
In order to perform the following practice, we will be using the Web Perspective . We should head to the top menu and go to Window | Open Perspective | Other…, then search the list for the Web option and finally click on OK.
We should now be able to see that the Web Perspective is currently available and enabled on the Eclipse UI as shown in the following screenshot:
It can be observed that as we go along adding Perspectives, these will be placed in the top-right area of the Eclipse UI so that we can easily switch between them using a single click.