• USA : +1 973 910 5725
  • INDIA: +91 905 291 3388
  • info@tekslate.com
  • Login

J2EE Tutorials

Welcome to J2EE Tutorials. The intent of the tutorials is to provide in depth understanding of J2EE. The JEE tutorials are a set of tutorials covering the Java Platform, Enterprise Edition. (JEE) The purpose of the tutorials is to introduce novice programmers to the JEE platform.

In addition to J2EE Tutorials, we will cover common interview questions, issues and how to’s of J2EE.

Introduction

Every good JEE programmer must acquire an enormous amount of knowledge. Everybody tells you what to study, but no one tells you how to study. One can easily be lost in all this tools, technologies, recommendations, libraries. There are many tools that help advance programmers develop their applications. But on the other hand, they bring additional complexity to development. Tools like XDoclet or Hibernate help advanced JEE programmers focus on the application logic, but necessarily make the learning curve steeper for a novice programmer. Have a look at the various Apache projects at www.apache.org. Ant, Cocoon, iBATIS, Struts, Maven, Tapestry, Xalan, Velocity. Just to name a few.

You cannot become a general, unless you were a private. You must go to the top, from the very bottom. There is no shortcut available. The best way for a novice programmer is a step by step approach. Pick one tool, library at a time and play with it. Realizing all this, I have made the tutorials to cope with all this complexity. We will begin with the very basic things like installing necessary tools, trying very simple JSP files or servlets.

Java Platforms

The world of Java is divided into the following three platforms.

Java Platform, Standard Edition, Java SE

Java Platform, Micro Edition, Java ME

-Java Platform, Enterprise Edition, Java EE

The Java SE is the core Java technology platform. It is used to create Java desktop and server applications. The Java ME is aimed at creating applications for portable devices like cell phones or PDAs. The Java EE is a platform for creating large enterprise applications. It adds libraries necessary to create stable, secure, multi-tier, distributed applications.

Java EE

Java Platform, Enterprise Edition is a set of libraries, tools, specifications, best practices for developing, deploying and managing server side enterprise level applications.

Each application is executed on the application server. Some of the well known application servers are JBoss, OCJ, Resin, and WebLogic. In this tutorials, we will use Resin. To create and manage source code, developers use Integrated Development Environments, (IDEs). The most popular Java IDEs are NetBeans, Eclipse, JDeveloper, and IntelliJ IDEA.

The key technologies of the Java EE are:

-Web Services Technologies

-Web Application Technologies

-Enterprise Application Technologies

-Management and Security Technologies

To install all this technologies, we can go to sun download site, or we can download the NetBeans JEE pack. These technologies are included in this pack.

The Java Platform, Enterprise Edition is not limited to these technologies. The platform has a wide variety of additional tools and libraries. The numerous Apache projects are good examples.

The Java EE also consists of a set of best practices, coding styles, and software patterns.

Web Application

An enterprise application consists of web modules. These are packaged in war files. A war (short for Web Archive) file is jar file used to distribute a collection of JavaServer Pages, servlets, Java classes, XML files, tag libraries and static Web pages. They create a web application. Smaller web applications can be packaged in a war file.

The root directory of this directory structure is called the document root. Let’s have a web application called email. For the Resin AS, the path to the document root would be:

RESIN_INSTALL_DIR/webapps/email 

We place our files and resources under the document root directory. All files are visible except for a special directory WEB-INF. All files under the WEB-INF directory are private and are not visible to the client. The WEB-INF directory is optional, but it is always created unless we create some very simple examples.

The WEB-INF directory contains two special files and two directories. The web.xml file is a web application deployment descriptor. It is used to configure the web application. The web.xml file is a Java EE deployment descriptor. It is defined by a specification. There is another type of descriptor called runtime deployment descriptor. It is used to configure Java EE implementation specific parameters. In the case of Resin Application Server, the runtime deployment descriptor is calledresin-web.xml. In case of GlassFish AS it is called sun-web.xml.

The two special directories are named classes and lib. We place all compiled servlets and utility classes under the classes directory. The lib directory contains additional libraries in form of JAR files. These can be e.g. third party libraries like database drivers or XML parsers.

It is conventional to put tag files into the tag directory.

Installing Java

The Java Development Kit (JDK). The JDK is a software development kit used to create Java applications. If we need to run Java applications, we only need the Java Runtime Environment (JRE). If we want to create Java applications, we also need the JDK. The JDK also includes JRE. Primary components of the Java Development Kit are Java compiler, launcher, documentation generator, debugger, disassembler, archiver.

There are three basic Java editions.

-Java SE – Java Standard Edition

-Java EE – Java Enterprise Edition

-Java ME – Java Micro Edition

If we download the JDK we can create Java SE applications. These are basically command line applications a Java Swing GUI applications. Java EE is used to create enterprise applications. The Java ME is used to create mobile applications. For both of them, we need to install additional libraries.

Steps

These are the steps to install the latest JDK on Linux. When I write these words it is JDK 6 Update 3.

-go to http://java.sun.com/

-select menu downloads – Java SE

-click on the download button of the latest JDK version

-accept licence agreement

-download the the appropriate version of java, Linux self-extracting file, 65.40 MB

-sudo chmod +x jdk-6u3-linux-i586.bin

./jdk-6u3-linux-i586.bin

-Do you agree to the above license terms? [yes or no] yes

-mv jdk1.6.0_03/ installdir

$ export PATH=$PATH:/home/vronskij/bin/jdk1.6.0_03/bin/

We add the bin directory to the PATH variable. On my computer the path to the Java bin directory is /home/vronskij/bin/jdk1.6.0_03/bin/.

$ java -version java version “1.6.0_03” Java(TM) SE Runtime Environment (build 1.6.0_03-b05) Java HotSpot(TM) Client VM (build 1.6.0_03-b05, mixed mode, sharing)

We verify the installed version of java. Now let’s create a simple Java console application. Launch your favourite text editor and write down the following code.

/* Console.java */

public class Console {

    public static void main(String[] args) {
        System.out.println("Java console application");
    }
}

This sample program will print text on the console window.
$ javac Console.java
$ ls
Console.class  Console.java  Console.java~
$ java Console
Java console application

We compile the source code with the javac command. Then we launch the program with the javacommand.

export JAVA_HOME=/home/vronskij/bin/jdk1.6.0_03/bin/

We set up the JAVA_HOME variable to point to our JDK. This is for other applications like ant or Netbeans, so that they know, where the Java has been installed.

Site Disclaimer, Copyright © 2016 - All Rights Reserved.

Support


Please leave a message and we'll get back to you soon.

I agree to be contacted via e-mail.