KEMBAR78
Java Introduction | PDF
Java Fundamentals
Middleware Trains
Java Fundamentals
Prasad
middleware.trains@gmail.com
Java Fundamentals
Java
Contents
 Java
 J2EE
 Application Packaging
 Class Loading
Java Fundamentals
Java
What is Java?
Programming Language :
They are set of code which performs a particular task
Ex : code to multiply 2 number / code to get a variable and process it ..
Programming Languages classification
• High level language vs low level language
• Compiler based vs Interpreter based
Java is high level compiler based language
Code.java (source) > compiled (using javac) > code.class > gets executed by JVM
.java files are human readable files
.class are JVM understandable files
PLATFORM
Java Fundamentals
Java
‘Java ‘ – Is Platform Independent , but how ?
Java is platform independent, but JVMs are platform Dependent
Windows Linux MAC
Java Code
JVM
Windows
JVM
Linux
JVM
MAC
Java Code is run on JVM
JVMs are run on Specific OS
Java Fundamentals
Java
Java Virtual Machine
JVM repositories are called JDK (Java developers kit)
JDK = JRE + Developers utilities
Java Fundamentals
Java
How Java Runs ?
Java Fundamentals
Java
Java Summary
• Java is a high level Compiler based programming language
• Java is platform Independent , (Java code can be executed on any
platform)
• Java is executed by a JVM (Java Virtual Machine)
• JVM is platform dependent
• JVM is a software which needs to be installed on platforms
• JVM ‘s repository is called JDK (Java Developers kit)
• JDK = JRE (Java runtime Environment ) + Developer’s utilities
• For a Java code to run/execute JRE is enough
• Latest version of JDK is Java8
• Java needs executed with Java Parameters
• Basic java parameters Min Heap size, Max Heap Size and Server variable
• -Xms and –Xmx, -Xms 512 -Xmx 2048
Java Fundamentals
J2EE
J2EE
Java Fundamentals
J2EE
J2EE - Java Standards
“J2EE is a java standard for application development, which is
collection of Java API and frame work for development”
Java
Standards
Expansion Uses
J2SE Java Standard
Edition
Java standard edition is a standard
format
J2EE Java Enterprise
Edition
J2SE+ Standard to maintain
Enterprise application
J2ME Java Mobile Edition J2SE+ Standards to Maintain Mobile
applications
Java Fundamentals
J2EE
MVC : Model View Controller (MVC) – Flow Architecture
• MVC architecture
• Java application Packaging
• Java Application utilities for enterprise (Servlets, JSP….)
In application ,
Java Fundamentals
J2EE
MVC Model ….
MVC Parts Enabling J2EE Components
Business Models Java Beans and EJBs
Controller Servlets
View Java Server Faces (jsf) / Java Servlet Pages (jsp)
Java Fundamentals
J2EE
J2EE Components
• Servlets - A server –side components used for routing/controlling
• Java Server Pages (JSPs) __ |Client -side component to receive and
• Java Server Faces (JSFs) | respond to client
• Enterprise Java Beans (EJBs) – Server-side component architecture
for modular construction of enterprise applications. The EJB
specification is one of several Java APIs in the Java EE
specification. EJB is a server-side model that encapsulates the
business logic of an application.
• Session Beans
• Entity Beans
• Message Driven Beans – Deprecate
---- Wikipedia
Java Fundamentals
J2EE
J2EE Containers
• Runtime to manage application components
• Provides access to J2EE APIs.
• Provides system level services such as Transaction, Security etc
• There are three types of containers
• Web Container (handles Servlet. JSP and JSF request)
• EJB Container (Handles EJB request)
• Embedded HTTP container (Handles static Request like HTML)
MVC Parts J2EE Components J2EE Containers
Models Java Beans and EJBs EJB Container
Controller Servlets Web Container
View JSP/JSF Web Container
Java Fundamentals
J2EE
J2EE APIs
• Data Base Connectivity-- JDBC
• Messaging Infrastructure-- JMS
• Transactions-- JTA
• Security-- JAAS
• Mail products-- JavaMail
• System Administration -- JMX
• Directory and Naming Services--JNDI
Java Fundamentals
J2EE
J2EE Architecture – Component Architecture
Application Server
Embedded
HTTPserver EJB ContainerWeb Container
HTML
JSP SessionServlet Entity
Native
Component
Java Virtual MachineJNDI
JDBC
JMS
Java
Mail
JTA
JMX
J2C
Data
Base
JDBC
Admin
JMX
MQ
JMS
Legacy
J2C
Web
Service
Browser
Client
Http
Server
http
http
SOAP
http
CSIv2
RMI
SSL
RMI/IIOP
Http
SOAP
TCP/UDP
UDDI
RMI/IIOP
Java Fundamentals
Application packaging
Application packaging
Java Fundamentals
Application packaging
Application Deployment - Environments
Development
Base
Application
Dev Config
Server 1
Testing
Base
Application
Test Config
Server 1
UAT
Base
Application
UAT Config
Server 1
Used by the client to
test the business
functions
Used by developers to
build the application
using development
tools like IDEs. The
connection
configurations are at
dev level
Used by admin/testers
to perform , testing like
manual testing ,
performance testing
etc. The connection
resources are at test
level
Java Fundamentals
Application packaging
Stage or Pre-Prod
Base
Application
Stage Config
This environment is the replica of the production
environment .This is also used as a back up for
Prod in case of emergency
Server 1 Server 2
Production
Base
Application
Prod Config
This is the actual live environment , Which
powers the application which is used by the end
users
Server 1 Server 2
Application Deployment - Environments
Java Fundamentals
Application packaging
Application packaging
“Application packaging is packing the java code in form a archive ,
its contents contain environmental references, Deployment
descriptors, java Source code and static contents “
The main uses of packaging the application are
• Avoid corruption of java files and file loss
• Easy to transfer between servers and environments
• Easy to deploy
• Easy to access the classes
Types of Packages
• JAR – Java Archive
• WAR – Web Archive
• EAR – Enterprise Archive
Java Fundamentals
Application packaging
Application packaging
Java Fundamentals
Application packaging
Request Flow
Url ear application.xml  war  web.xml  classes(inside
jar)
Java Fundamentals
Application packaging
J2EE EAR Files
ear
EJB
Module
Web
Module
Java
Utility Jar
Resource
Adapter
Client
Modules
Java
Persistence
EJB DD
EJB Ext DD
EJB Bind DD
Web DD
Web Ext DD
Web Bind DD
Client DD
Client Ext DD
Client Bind DD
Resource DD
Persistence DD
Java Fundamentals
Application packaging
Deployment Descriptors
“A deployment descriptor (DD) refers to a configuration file for
an artifact that is deployed to some java container”
• The deployment descriptor must be called web.xml and must reside
in the WEB-INF directory in the web application root.
• For Java EE applications, the deployment descriptor must be named
application.xml and must be placed directly in the META-INF
directory at the top level of the application .ear file.
Java Fundamentals
Class loaders
Class Loading
Java Fundamentals
Class loaders
What are Class Loaders ?
Class loaders find and load class files. Class loaders enable applications that
are deployed on servers to access repositories of available classes and
resources.
Application developers and deployer must consider the location of class and
resource files, and the class loaders used to access those files, to make the files
available to deployed applications
Types of class loading
1. JVM Class loading
1. Bootstrap class loading
2. Extension Class loading
2. Weblogic class loading
3. Application Class loading
4. Module class loading
Java Fundamentals
Class loaders
What are Class Loaders ?
Types of class loading
1. JVM Class loading
1. Bootstrap class loading - C:Program FilesJavajdk1.7.0_45jrelib
2. Extension Class loading -C:Program FilesJavajdk1.7.0_45jrelibext
2. System Class loaders – Location of the middleware installed (its lib)
3. Application Class loading – Location of the deployed application (its lib)
4. Module class loading – Applications
Java Fundamentals
Class loaders
Class Loaders Big Picture
JVM class Loaders
System Class Loaders
App class Loaders
Module Level
Class Loaders
App class Loaders
Module Level
Class Loaders
Module Level
Class Loaders
Module Level
Class Loaders

Java Introduction

  • 1.
    Java Fundamentals Middleware Trains JavaFundamentals Prasad middleware.trains@gmail.com
  • 2.
    Java Fundamentals Java Contents  Java J2EE  Application Packaging  Class Loading
  • 3.
    Java Fundamentals Java What isJava? Programming Language : They are set of code which performs a particular task Ex : code to multiply 2 number / code to get a variable and process it .. Programming Languages classification • High level language vs low level language • Compiler based vs Interpreter based Java is high level compiler based language Code.java (source) > compiled (using javac) > code.class > gets executed by JVM .java files are human readable files .class are JVM understandable files
  • 4.
    PLATFORM Java Fundamentals Java ‘Java ‘– Is Platform Independent , but how ? Java is platform independent, but JVMs are platform Dependent Windows Linux MAC Java Code JVM Windows JVM Linux JVM MAC Java Code is run on JVM JVMs are run on Specific OS
  • 5.
    Java Fundamentals Java Java VirtualMachine JVM repositories are called JDK (Java developers kit) JDK = JRE + Developers utilities
  • 6.
  • 7.
    Java Fundamentals Java Java Summary •Java is a high level Compiler based programming language • Java is platform Independent , (Java code can be executed on any platform) • Java is executed by a JVM (Java Virtual Machine) • JVM is platform dependent • JVM is a software which needs to be installed on platforms • JVM ‘s repository is called JDK (Java Developers kit) • JDK = JRE (Java runtime Environment ) + Developer’s utilities • For a Java code to run/execute JRE is enough • Latest version of JDK is Java8 • Java needs executed with Java Parameters • Basic java parameters Min Heap size, Max Heap Size and Server variable • -Xms and –Xmx, -Xms 512 -Xmx 2048
  • 8.
  • 9.
    Java Fundamentals J2EE J2EE -Java Standards “J2EE is a java standard for application development, which is collection of Java API and frame work for development” Java Standards Expansion Uses J2SE Java Standard Edition Java standard edition is a standard format J2EE Java Enterprise Edition J2SE+ Standard to maintain Enterprise application J2ME Java Mobile Edition J2SE+ Standards to Maintain Mobile applications
  • 10.
    Java Fundamentals J2EE MVC :Model View Controller (MVC) – Flow Architecture • MVC architecture • Java application Packaging • Java Application utilities for enterprise (Servlets, JSP….) In application ,
  • 11.
    Java Fundamentals J2EE MVC Model…. MVC Parts Enabling J2EE Components Business Models Java Beans and EJBs Controller Servlets View Java Server Faces (jsf) / Java Servlet Pages (jsp)
  • 12.
    Java Fundamentals J2EE J2EE Components •Servlets - A server –side components used for routing/controlling • Java Server Pages (JSPs) __ |Client -side component to receive and • Java Server Faces (JSFs) | respond to client • Enterprise Java Beans (EJBs) – Server-side component architecture for modular construction of enterprise applications. The EJB specification is one of several Java APIs in the Java EE specification. EJB is a server-side model that encapsulates the business logic of an application. • Session Beans • Entity Beans • Message Driven Beans – Deprecate ---- Wikipedia
  • 13.
    Java Fundamentals J2EE J2EE Containers •Runtime to manage application components • Provides access to J2EE APIs. • Provides system level services such as Transaction, Security etc • There are three types of containers • Web Container (handles Servlet. JSP and JSF request) • EJB Container (Handles EJB request) • Embedded HTTP container (Handles static Request like HTML) MVC Parts J2EE Components J2EE Containers Models Java Beans and EJBs EJB Container Controller Servlets Web Container View JSP/JSF Web Container
  • 14.
    Java Fundamentals J2EE J2EE APIs •Data Base Connectivity-- JDBC • Messaging Infrastructure-- JMS • Transactions-- JTA • Security-- JAAS • Mail products-- JavaMail • System Administration -- JMX • Directory and Naming Services--JNDI
  • 15.
    Java Fundamentals J2EE J2EE Architecture– Component Architecture Application Server Embedded HTTPserver EJB ContainerWeb Container HTML JSP SessionServlet Entity Native Component Java Virtual MachineJNDI JDBC JMS Java Mail JTA JMX J2C Data Base JDBC Admin JMX MQ JMS Legacy J2C Web Service Browser Client Http Server http http SOAP http CSIv2 RMI SSL RMI/IIOP Http SOAP TCP/UDP UDDI RMI/IIOP
  • 16.
  • 17.
    Java Fundamentals Application packaging ApplicationDeployment - Environments Development Base Application Dev Config Server 1 Testing Base Application Test Config Server 1 UAT Base Application UAT Config Server 1 Used by the client to test the business functions Used by developers to build the application using development tools like IDEs. The connection configurations are at dev level Used by admin/testers to perform , testing like manual testing , performance testing etc. The connection resources are at test level
  • 18.
    Java Fundamentals Application packaging Stageor Pre-Prod Base Application Stage Config This environment is the replica of the production environment .This is also used as a back up for Prod in case of emergency Server 1 Server 2 Production Base Application Prod Config This is the actual live environment , Which powers the application which is used by the end users Server 1 Server 2 Application Deployment - Environments
  • 19.
    Java Fundamentals Application packaging Applicationpackaging “Application packaging is packing the java code in form a archive , its contents contain environmental references, Deployment descriptors, java Source code and static contents “ The main uses of packaging the application are • Avoid corruption of java files and file loss • Easy to transfer between servers and environments • Easy to deploy • Easy to access the classes Types of Packages • JAR – Java Archive • WAR – Web Archive • EAR – Enterprise Archive
  • 20.
  • 21.
    Java Fundamentals Application packaging RequestFlow Url ear application.xml  war  web.xml  classes(inside jar)
  • 22.
    Java Fundamentals Application packaging J2EEEAR Files ear EJB Module Web Module Java Utility Jar Resource Adapter Client Modules Java Persistence EJB DD EJB Ext DD EJB Bind DD Web DD Web Ext DD Web Bind DD Client DD Client Ext DD Client Bind DD Resource DD Persistence DD
  • 23.
    Java Fundamentals Application packaging DeploymentDescriptors “A deployment descriptor (DD) refers to a configuration file for an artifact that is deployed to some java container” • The deployment descriptor must be called web.xml and must reside in the WEB-INF directory in the web application root. • For Java EE applications, the deployment descriptor must be named application.xml and must be placed directly in the META-INF directory at the top level of the application .ear file.
  • 24.
  • 25.
    Java Fundamentals Class loaders Whatare Class Loaders ? Class loaders find and load class files. Class loaders enable applications that are deployed on servers to access repositories of available classes and resources. Application developers and deployer must consider the location of class and resource files, and the class loaders used to access those files, to make the files available to deployed applications Types of class loading 1. JVM Class loading 1. Bootstrap class loading 2. Extension Class loading 2. Weblogic class loading 3. Application Class loading 4. Module class loading
  • 26.
    Java Fundamentals Class loaders Whatare Class Loaders ? Types of class loading 1. JVM Class loading 1. Bootstrap class loading - C:Program FilesJavajdk1.7.0_45jrelib 2. Extension Class loading -C:Program FilesJavajdk1.7.0_45jrelibext 2. System Class loaders – Location of the middleware installed (its lib) 3. Application Class loading – Location of the deployed application (its lib) 4. Module class loading – Applications
  • 27.
    Java Fundamentals Class loaders ClassLoaders Big Picture JVM class Loaders System Class Loaders App class Loaders Module Level Class Loaders App class Loaders Module Level Class Loaders Module Level Class Loaders Module Level Class Loaders