SlideShare a Scribd company logo
What is new in Java SE
7 and – Java Enterprise
Edition 6
Eugene Bogaart
Solution Architect
Sun Microsystems

                          1
JDK 7 Features
> Language
 • Annotations on Java types
 • Small language changes (Project Coin)
 • Modularity (JSR-294)
> Core
 •   Modularisation (Project Jigsaw)
 •   Concurrency and collections updates
 •   More new IO APIs (NIO.2)
 •   Additional network protocol support
 •   Eliptic curve cryptography
 •   Unicode 5.1
                                           2
JDK 7 Features
> VM
 • Compressed 64-bit pointers
 • Garbage-First GC
 • Support for dynamic languages (Da Vinci Machine
   project)
> Client
 • Forward port Java SE6 u10 features
 • XRender pipeline for Java 2D




                                                     3
Modularity
 Project Jigsaw



                  4
New Module System for Java
• JSR-294 Improved Modularity Support in the Java
  Programming Language
• Requirements for JSR-294
  >   Integrate with the VM
  >   Integrate with the language
  >   Integrate with (platform's) native packaging
  >   Support multi-module packages
  >   Support “friend” modules
• Open JDK's Project Jigsaw
  > Reference implementation for JSR-294
  > openjdk.java.net/projects/jigsaw
  > Can have other type of module systems based on OSGi, IPS,
      Debian, etc.
                                                                5
Modularizing You Code
planetjdk/src/
            org/planetjdk/aggregator/Main.java



                    Modularize


planetjdk/src/
            org/planetjdk/aggregator/Main.java
            module-info.java


                                                 6
module-info.java                   Module name

 module org.planetjdk.aggregator {
                                 Module system
    system jigsaw;
    requires module jdom;
    requires module tagsoup;
    requires module rome;
                                     Dependencies
    requires module rome-fetcher;
    requires module joda-time;
    requires module java-xml;
    requires module java-base;
    class org.planetjdk.aggregator.Main;
 }                                     Main class
                                                    7
Module Versioning
module org.planetjdk.aggregator @ 1.0 {
   system jigsaw;
   requires module jdom @ 1.*;
   requires module tagsoup @ 1.2.*;
   requires module rome @ =1.0;
   requires module rome-fetcher @ =1.0;
   requires module joda-time @ [1.6,2.0);
   requires module java-xml @ 7.*;
   requires module java-base @ 7.*;
   class org.planetjdk.aggregator.Main;
}
                                            8
Small
(Language)
 Changes
  Project Coin

                 9
Better Integer Literals
• Binary literals
 int mask = 0b1010;
• With underscores
 int bigMask = 0b1010_0101;
 long big = 9_223_783_036_967_937L;
• Unsigned literals
 byte b = 0xffu;



                                      10
Better Type Inference

 Map<String, Integer> foo =
     new HashMap<String, Integer>();

 Map<String, Integer> foo =
     new HashMap<>();




                                       11
Strings in Switch
• Strings are constants too
       String s = ...;
       switch (s) {
         case "foo":
            return 1;

           case "bar":
             Return 2;

           default:
             return 0;
       }
                              12
Resource Management
• Manually closing resources is tricky and tedious
public void copy(String src, String dest) throws IOException {
   InputStream in = new FileInputStream(src);
   try {
       OutputStream out = new FileOutputStream(dest);
       try {
          byte[] buf = new byte[8 * 1024];
          int n;
          while ((n = in.read(buf)) >= 0)
              out.write(buf, 0, n);
       } finally {
          out.close();
       }
   } finally {
       in.close();
}}
                                                           13
Automatic Resource Management

static void copy(String src, String dest)
      throws IOException {
    try (InputStream in = new FileInputStream(src);
         OutputStream out = new FileOutputStream(dest)) {
        byte[] buf = new byte[8192];
        int n;
        while ((n = in.read(buf)) >= 0)
            out.write(buf, 0, n);
    }
   //in and out closes
}



                                                        14
Index Syntax for Lists and Maps

List<String> list =
  Arrays.asList(new String[] {"a", "b", "c"});
String firstElement = list[0];

Map<Integer, String> map = new HashMap<>();
map[Integer.valueOf(1)] = "One";




                                              15
Dynamic
 Languages
  Support
Da Vinci Machine Project

                           16
JVM Specification



“The Java virtual machine knows nothing
about the Java programming language, only
of a particular binary format, the class file
format.”
                         1.2 The Java Virtual Machine



                                                        17
Languages Running on the JVM
                                                                           Tea              iScript
 Zigzag                                           JESS                       Jickle
                      Modula-2                                    Lisp
          Correlate                    Nice
                                                         CAL
                                                                           JudoScript
                                                                                      JavaScript
                              Simkin                 Drools     Basic
 Icon       Groovy                       Eiffel                                               Luck
                                                         v-language               Pascal
                              Prolog          Mini
                      Tcl                                         PLAN        Hojo            Scala
Rexx                        JavaFX Script                                Funnel
            Tiger           Anvil                               Yassl                     FScript
                                                                                      Oberon
    E                               Smalltalk
            Logo  Tiger                                          JHCR         JRuby
  Ada                G                                         Scheme                         Sather
                          Clojure
                                                                         Phobos
 Processing    WebL Dawn                                   TermWare
                                                                                           Sleep
                        LLP                                                  Pnuts         Bex Script
         BeanShell        Forth                           PHP
                                       C#
                                              Yoix           SALSA        ObjectScript
                        Jython                            Piccola                                            18


                                                                                                        18
InvokeDynamic Bytecode
• JVM currently has four ways to invoke method
  > Invokevirtual, invokeinterface, invokestatic, invokespecial
• All require full method signature data
• InvokeDynamic will use method handle
  > Effectively an indirect pointer to the method
• When dynamic method is first called bootstrap code
  determines method and creates handle
• Subsequent calls simply reference defined handle
• Type changes force a re-compute of the method location
  and an update to the handle
  > Method call changes are invisible to calling code
                                                                  19
Bootstrapping Method Handle




                              20
invokedynamic Byte Code


                              Call site reifies the call




pink = CallSite object
green = MethodHandle object
                                                           21
JDK 7 Milestone Timeline
• M5        29 Oct 2009
    >   Concurrency and collections updates (jsr166y)
    >   Elliptic-curve cryptography (ECC)
    >   JSR TBD: Small language enhancements (Project Coin)
    >   Swing updates
    >   Update the XML stack
•   M6      18 Feb 2010
•   M7      15 Apr 2010
•   M8      3 Jun 2010             Feature complete
•   M9      22 Jul 2010
•   M10     9 Sep 2010
                                                              22
More information
• On OpenJDK7
• http://www.javapassion.com/javaee6/




                                        23
Java EE: Past & Present
                                                                         Rightsizing
                                                           Ease of
                                                         Development    Java EE 6
                                               Web
                                              Services                   Pruning
                                                         Java EE 5      Extensibility
                             Robustness                                  Profiles
           Enterprise Java                                 Ease of
              Platform
                                            J2EE 1.4     Development     Ease of
                                                                        Development
                                                         Annotations
                             J2EE 1.3          Web                       EJB Lite
            J2EE 1.2                         Services      EJB 3.0
                                                                         RESTful
                                            Management
                                CMP                      Persistence     Services
               Servlet                      Deployment
  JPE                         Connector                   New and       Dependency
 Project        JSP          Architecture     Async.      Updated        Ejection
                EJB                          Connector   Web Services
                JMS                                                     Web Profile
              RMI/IIOP

                                                                                        24
Java EE 6
Final release December
         10, 2009


                         25
Java EE 5
J2EE 1.4                   Java EE 5
• Deployment               • Java language
  descriptors                annotations @
• Required container       • Plain Old Java Objects
  interfaces                 (POJOs)
• JNDI Lookups             • Dependency Injection
• Deployment               • More and better defaults
  descriptor, interfaces
• No Supported UI          • Java Server Faces(JSF)
  Framework
                                                    26
Java EE 6
 GOALS



            27
Java EE 6 Platform
Goals
• Rightsizing
  > Flexible
  > Lighter weight
• Extensible
  > Embrace Open Source
     Frameworks
• Productive
  > Improve on Java EE 5

                           28
Rightsizing the Platform
Platform Flexibility

• Decouple specifications to
  allow more combinations
• Expand potiential licensee
  ecosystem
• Profiles
  > Targeted technology bundles
  > Web Profile


                                  29
About Profiles
•   Profiles are targeted bundles of technologies
•   (Simple) rules set by platform spec
•   Profiles can be subsets, supersets or overlapping
•   First profile: the Web Profile
•   Decoupling of specs to allow more combinations
•   Future profiles defined in the Java Community
    Process



                                                        30
Rightsizing the Platform
Web Profile

• Fully functional mid-sized
  profile
• Actively discussed
  > Expert Group
  > Industry
• Technologies
  > Servlet 3.0, EJB Lite 3.1, JPA 2.0, JSP
    2.2, EL 1.2, JSTL 1.2, JSF 2.0, JTA
    1.1, JSR 45, Common Annotations
                                              31
Rightsizing the Platform
Pruning (Deprecation)

• Some technologies optional
  > Optional in next release
  > Deleted in subsequent release
  > Marked in Javadocs
• Pruning list
  >   JAX-RPC
  >   EJB 2.x Entity Beans
  >   JAXR
  >   JSR-85 (Rules based Auth & Audit)
                                          32
About Pruning
• Make some technologies optional
• Reduce the real and conceptual footprint
• Same rules as proposed by the Java SE
  > “pruned now, optional in the next release”
• Pruned technologies will be marked in the javadocs
• Current pruning list:
  > JAX-RPC, EJB Entity Beans, JAXR, JSR-88




                                                       33
Rightsizing the Platform
Extensibility

• Embrace open source
  libraries and frameworks
• Zero-configuration, drag-n-
  drop web frameworks
  > Servlets, servlet filters
  > Framework context listeners
    are discovered & registered
• Plugin library jars using Web
  Fragments
                                  34
Ease of Development
Extensibility

•   Continue Java EE 5 advancements
•   Primary focus: Web Tier
•   Multiple areas easier to use: EJB 3.1
•   General Principles
    > Annotation-based programming model
    > Reduce or eliminate need for
      deployment descriptors
    > Traditional API for advanced users


                                            35
About Extensibility
• Embrace open source libraries and frameworks
• Zero-configuration, drag-and-drop for web
  frameworks
  > Monolithic web.xml can become complex to maintain as
    the dependencies of the application increases
  > Servlets, servlet filters, context listeners for a framework
    get discovered and registered automatically
• Completely general solution using web fragments
• Scripting languages can use the same mechanism


                                                                   36
Ease of Development
•   Ongoing effort
•   This time focus is the web tier
•   Lots of opportunities in other areas, e.g. EJB
•   General principles:
    > Use of annotations across all web APIs
    > Reduce or eliminate need for deployment descriptors
       – No editing of web.xml required
    > Self-registration of third-party libraries
    > Simplified packaging
    > JAX-RS for RESTful web services
    > Get technologies to work together well
                                                            37
Java EE 6
Platform Summary



                   38
Java EE 6 Platform
What's New?

• Several new APIs
• Web Profile
• Pluggability/extensibility
• Dependency injection
• Many improvements to APIs


                               39
Java EE 6 Platform
New Technologies

• JAX-RS 1.1
• Bean Validation 1.0
• Dependency injection 1.0
• CDI 1.0
• Managed Beans 1.0


                             40
Java EE 6 Platform
Updated Technolgies

• EJB 3.1        • JAX-WS 2.2
• JPA 2.0        • JSR-109 1.3
• Servlet 3.0    • JSP 2.2
• JSF 2.0        • EL 2.2
• Connectors 1.6 • JSR-250 1.1
• Interceptors 1.1 • JACC 1.4
                 • JASPIC 1.0    41
Java EE 6
 Samples



            42
Ease of Development
Adding an EJB to a Web Application

                 ShoppingCart
  BuyBooks.war    EJB Class          BuyBooks.war



                 ShoppingCart.jar
                                     ShoppingCart
                                      EJB Class

  BuyBooks.ear

                                                    43
Java EE Platform 5 Packaging




                               44
Java EE Platform 6 Packaging




                               45
Session Bean with No - Interface




                                   46
Ease of Development - Annotations
Servlet in Java EE 5: Create two source files
/* Code in Java Class */         <!--Deployment descriptor web.xml
                                    -->
package com.foo;                 <web-app>
public class MyServlet extends      <servlet>
HttpServlet {                           <servlet-name>MyServlet
public void                              </servlet-name>
doGet(HttpServletRequest                <servlet-class>
req,HttpServletResponse res)              com.foo.MyServlet
                                        </servlet-class>
{                                   </servlet>
                                    <servlet-mapping>
...                                     <servlet-name>MyServlet
                                        </servlet-name>
}                                       <url-pattern>/myApp/*
                                        </url-pattern>
...                                 </servlet-mapping>
                                    ...
}                                </web-app>

                                                                     47
Ease of Development - Annotations
Servlet in Java EE 5: Java Class
/* Code in Java Class */

package com.foo;

public class MyServlet extends HttpServlet {

    public void doGet(HttpServletRequest req,HttpServletResponse res) {
        /* doGet body */
    }
}




                                                                          48
Ease of Development - Annotations
Servlet in Java EE 5: Descriptor
 <!--Deployment descriptor web.xml -->
 <web-app>
    <servlet>
        <servlet-name>MyServlet
         </servlet-name>
        <servlet-class>
          com.foo.MyServlet
        </servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>MyServlet
        </servlet-name>
        <url-pattern>/myApp/*
        </url-pattern>
    </servlet-mapping>
    ...
 </web-app>


                                         49
Ease of Development - Annotations
Java EE 6 Servlet: Single Source file (many cases)

package com.foo;
@WebServlet(name=”MyServlet”, urlPattern=”/myApp/*”)
public class MyServlet extends HttpServlet {
   public void doGet(HttpServletRequest req,
                   HttpServletResponse res)
   {
      ...
   }




                                                       50
Demos
Java EE 6

            51
Demo Setup



                   Enterprise       Java
  JavaServer
                  Java Beans     Persistence      JavaDB
     Faces
                   (Business         API        (Database)
 (presentation)
                     Logic)     (Data Access)




                                                             52
Summary
•   Java continues to evolve
•   JDK7 driving changes in the platform
•   JavaFX providing a RIA platform built on Java
•   More to come...




                                                    53
More information
• Tutorial On Java EE 6
• Webinar on Java EE 6
• http://www.javapassion.com/javaee6/




                                        54
Thanks
Eugene Bogaart
Eugene.Bogaart@sun.com


                         55

More Related Content

What's hot (14)

PDF
Turmeric SOA Cloud Mashups
kingargyle
 
KEY
Know yourengines velocity2011
Demis Bellot
 
KEY
Have Your Cake and Eat It Too: Meta-Programming Techniques for Java
Howard Lewis Ship
 
PDF
Introduction to Clojure
Renzo Borgatti
 
PDF
XS Boston 2008 Paravirt Ops in Linux IA64
The Linux Foundation
 
PDF
DSLs in JavaScript
elliando dias
 
PDF
Clojure - An Introduction for Lisp Programmers
elliando dias
 
PDF
Clojure - An Introduction for Java Programmers
elliando dias
 
PDF
Clojure talk at Münster JUG
Alex Ott
 
ODP
I Know Kung Fu - Juggling Java Bytecode
Alexander Shopov
 
PDF
Lifting The Veil - Reading Java Bytecode
Alexander Shopov
 
PDF
Lifting The Veil - Reading Java Bytecode During Lunchtime
Alexander Shopov
 
PDF
javascript teach
guest3732fa
 
PDF
Quick Intro To JRuby
Frederic Jean
 
Turmeric SOA Cloud Mashups
kingargyle
 
Know yourengines velocity2011
Demis Bellot
 
Have Your Cake and Eat It Too: Meta-Programming Techniques for Java
Howard Lewis Ship
 
Introduction to Clojure
Renzo Borgatti
 
XS Boston 2008 Paravirt Ops in Linux IA64
The Linux Foundation
 
DSLs in JavaScript
elliando dias
 
Clojure - An Introduction for Lisp Programmers
elliando dias
 
Clojure - An Introduction for Java Programmers
elliando dias
 
Clojure talk at Münster JUG
Alex Ott
 
I Know Kung Fu - Juggling Java Bytecode
Alexander Shopov
 
Lifting The Veil - Reading Java Bytecode
Alexander Shopov
 
Lifting The Veil - Reading Java Bytecode During Lunchtime
Alexander Shopov
 
javascript teach
guest3732fa
 
Quick Intro To JRuby
Frederic Jean
 

Viewers also liked (7)

PDF
Pro JavaFX Platform - Building Enterprise Applications with JavaFX
Stephen Chin
 
PDF
Introduction into JavaFX
Eugene Bogaart
 
PPTX
Ankor Presentation @ JavaOne San Francisco September 2014
manolitto
 
PDF
Tweet4Beer - Beertap powered by Java goes IoT and JavaFX
Bruno Borges
 
PDF
Java Enterprise Edition 6 Overview
Eugene Bogaart
 
PDF
Building Java Desktop Apps with JavaFX 8 and Java EE 7
Bruno Borges
 
PDF
JavaOneで聴いてきたディープなJavaFXセッション
Takashi Aoe
 
Pro JavaFX Platform - Building Enterprise Applications with JavaFX
Stephen Chin
 
Introduction into JavaFX
Eugene Bogaart
 
Ankor Presentation @ JavaOne San Francisco September 2014
manolitto
 
Tweet4Beer - Beertap powered by Java goes IoT and JavaFX
Bruno Borges
 
Java Enterprise Edition 6 Overview
Eugene Bogaart
 
Building Java Desktop Apps with JavaFX 8 and Java EE 7
Bruno Borges
 
JavaOneで聴いてきたディープなJavaFXセッション
Takashi Aoe
 
Ad

Similar to What is new and cool j2se & java (20)

PDF
Ola Bini Evolving The Java Platform
deimos
 
PPTX
JVM: A Platform for Multiple Languages
Kris Mok
 
PPTX
Java Starting
Raja Sekhar
 
PDF
Java Future S Ritter
catherinewall
 
PDF
The Forces Driving Java
Steve Elliott
 
DOCX
Java 7 Dolphin manjula kollipara
Manjula Kollipara
 
PDF
What`s new in Java 7
Georgian Micsa
 
PDF
Powering the Next Generation Services with Java Platform - Spark IT 2010
Arun Gupta
 
PPT
Java security
Ankush Kumar
 
PDF
Building Atlassian Plugins with Groovy - Atlassian Summit 2010 - Lightning Talks
Atlassian
 
PDF
Terence Barr - jdk7+8 - 24mai2011
Agora Group
 
KEY
Scala Introduction
Adrian Spender
 
PDF
Mixing Source and Bytecode: A Case for Compilation By Normalization (OOPSLA 2...
lennartkats
 
PDF
New Features of Java7 SE
dogangoko
 
PDF
JDK7: Improved support for dynamic languages
Sander Mak (@Sander_Mak)
 
PDF
Java: Rumours of my demise are greatly exaggerated
Steve Dalton
 
PDF
Java se-7-evolves-toulouse-jug-2001-09-14
Baptiste Mathus
 
PPT
Wakanda: Integrated Web Application Development with NoSQL and JavaScript
Juergen Fesslmeier
 
PDF
groovy
Shilong Sang
 
DOC
6010 java programming version 6
bestip
 
Ola Bini Evolving The Java Platform
deimos
 
JVM: A Platform for Multiple Languages
Kris Mok
 
Java Starting
Raja Sekhar
 
Java Future S Ritter
catherinewall
 
The Forces Driving Java
Steve Elliott
 
Java 7 Dolphin manjula kollipara
Manjula Kollipara
 
What`s new in Java 7
Georgian Micsa
 
Powering the Next Generation Services with Java Platform - Spark IT 2010
Arun Gupta
 
Java security
Ankush Kumar
 
Building Atlassian Plugins with Groovy - Atlassian Summit 2010 - Lightning Talks
Atlassian
 
Terence Barr - jdk7+8 - 24mai2011
Agora Group
 
Scala Introduction
Adrian Spender
 
Mixing Source and Bytecode: A Case for Compilation By Normalization (OOPSLA 2...
lennartkats
 
New Features of Java7 SE
dogangoko
 
JDK7: Improved support for dynamic languages
Sander Mak (@Sander_Mak)
 
Java: Rumours of my demise are greatly exaggerated
Steve Dalton
 
Java se-7-evolves-toulouse-jug-2001-09-14
Baptiste Mathus
 
Wakanda: Integrated Web Application Development with NoSQL and JavaScript
Juergen Fesslmeier
 
groovy
Shilong Sang
 
6010 java programming version 6
bestip
 
Ad

More from Eugene Bogaart (6)

PDF
EDA With Glassfish ESB Jfall IEP Intelligent Event Processing
Eugene Bogaart
 
PDF
Glassfish Overview 29 Oktober 2009
Eugene Bogaart
 
ODP
Gf University 27may09 Amersfoort
Eugene Bogaart
 
PDF
Glass Fish V3 University Amers May2009
Eugene Bogaart
 
PDF
Glassfish Overview Fontys 20090520
Eugene Bogaart
 
PDF
Glassfish Overview for Sogeti 20090225
Eugene Bogaart
 
EDA With Glassfish ESB Jfall IEP Intelligent Event Processing
Eugene Bogaart
 
Glassfish Overview 29 Oktober 2009
Eugene Bogaart
 
Gf University 27may09 Amersfoort
Eugene Bogaart
 
Glass Fish V3 University Amers May2009
Eugene Bogaart
 
Glassfish Overview Fontys 20090520
Eugene Bogaart
 
Glassfish Overview for Sogeti 20090225
Eugene Bogaart
 

Recently uploaded (20)

PDF
Human-centred design in online workplace learning and relationship to engagem...
Tracy Tang
 
PDF
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PDF
Predicting the unpredictable: re-engineering recommendation algorithms for fr...
Speck&Tech
 
PDF
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
PDF
Blockchain Transactions Explained For Everyone
CIFDAQ
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PDF
Why Orbit Edge Tech is a Top Next JS Development Company in 2025
mahendraalaska08
 
PPTX
MSP360 Backup Scheduling and Retention Best Practices.pptx
MSP360
 
PDF
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
PDF
Impact of IEEE Computer Society in Advancing Emerging Technologies including ...
Hironori Washizaki
 
PDF
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PDF
Building Resilience with Digital Twins : Lessons from Korea
SANGHEE SHIN
 
PDF
Windsurf Meetup Ottawa 2025-07-12 - Planning Mode at Reliza.pdf
Pavel Shukhman
 
PDF
NewMind AI Journal - Weekly Chronicles - July'25 Week II
NewMind AI
 
PDF
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
PDF
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
Human-centred design in online workplace learning and relationship to engagem...
Tracy Tang
 
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
Predicting the unpredictable: re-engineering recommendation algorithms for fr...
Speck&Tech
 
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
Blockchain Transactions Explained For Everyone
CIFDAQ
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
Why Orbit Edge Tech is a Top Next JS Development Company in 2025
mahendraalaska08
 
MSP360 Backup Scheduling and Retention Best Practices.pptx
MSP360
 
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
Impact of IEEE Computer Society in Advancing Emerging Technologies including ...
Hironori Washizaki
 
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
Building Resilience with Digital Twins : Lessons from Korea
SANGHEE SHIN
 
Windsurf Meetup Ottawa 2025-07-12 - Planning Mode at Reliza.pdf
Pavel Shukhman
 
NewMind AI Journal - Weekly Chronicles - July'25 Week II
NewMind AI
 
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 

What is new and cool j2se & java

  • 1. What is new in Java SE 7 and – Java Enterprise Edition 6 Eugene Bogaart Solution Architect Sun Microsystems 1
  • 2. JDK 7 Features > Language • Annotations on Java types • Small language changes (Project Coin) • Modularity (JSR-294) > Core • Modularisation (Project Jigsaw) • Concurrency and collections updates • More new IO APIs (NIO.2) • Additional network protocol support • Eliptic curve cryptography • Unicode 5.1 2
  • 3. JDK 7 Features > VM • Compressed 64-bit pointers • Garbage-First GC • Support for dynamic languages (Da Vinci Machine project) > Client • Forward port Java SE6 u10 features • XRender pipeline for Java 2D 3
  • 5. New Module System for Java • JSR-294 Improved Modularity Support in the Java Programming Language • Requirements for JSR-294 > Integrate with the VM > Integrate with the language > Integrate with (platform's) native packaging > Support multi-module packages > Support “friend” modules • Open JDK's Project Jigsaw > Reference implementation for JSR-294 > openjdk.java.net/projects/jigsaw > Can have other type of module systems based on OSGi, IPS, Debian, etc. 5
  • 6. Modularizing You Code planetjdk/src/ org/planetjdk/aggregator/Main.java Modularize planetjdk/src/ org/planetjdk/aggregator/Main.java module-info.java 6
  • 7. module-info.java Module name module org.planetjdk.aggregator { Module system system jigsaw; requires module jdom; requires module tagsoup; requires module rome; Dependencies requires module rome-fetcher; requires module joda-time; requires module java-xml; requires module java-base; class org.planetjdk.aggregator.Main; } Main class 7
  • 8. Module Versioning module org.planetjdk.aggregator @ 1.0 { system jigsaw; requires module jdom @ 1.*; requires module tagsoup @ 1.2.*; requires module rome @ =1.0; requires module rome-fetcher @ =1.0; requires module joda-time @ [1.6,2.0); requires module java-xml @ 7.*; requires module java-base @ 7.*; class org.planetjdk.aggregator.Main; } 8
  • 9. Small (Language) Changes Project Coin 9
  • 10. Better Integer Literals • Binary literals int mask = 0b1010; • With underscores int bigMask = 0b1010_0101; long big = 9_223_783_036_967_937L; • Unsigned literals byte b = 0xffu; 10
  • 11. Better Type Inference Map<String, Integer> foo = new HashMap<String, Integer>(); Map<String, Integer> foo = new HashMap<>(); 11
  • 12. Strings in Switch • Strings are constants too String s = ...; switch (s) { case "foo": return 1; case "bar": Return 2; default: return 0; } 12
  • 13. Resource Management • Manually closing resources is tricky and tedious public void copy(String src, String dest) throws IOException { InputStream in = new FileInputStream(src); try { OutputStream out = new FileOutputStream(dest); try { byte[] buf = new byte[8 * 1024]; int n; while ((n = in.read(buf)) >= 0) out.write(buf, 0, n); } finally { out.close(); } } finally { in.close(); }} 13
  • 14. Automatic Resource Management static void copy(String src, String dest) throws IOException { try (InputStream in = new FileInputStream(src); OutputStream out = new FileOutputStream(dest)) { byte[] buf = new byte[8192]; int n; while ((n = in.read(buf)) >= 0) out.write(buf, 0, n); } //in and out closes } 14
  • 15. Index Syntax for Lists and Maps List<String> list = Arrays.asList(new String[] {"a", "b", "c"}); String firstElement = list[0]; Map<Integer, String> map = new HashMap<>(); map[Integer.valueOf(1)] = "One"; 15
  • 16. Dynamic Languages Support Da Vinci Machine Project 16
  • 17. JVM Specification “The Java virtual machine knows nothing about the Java programming language, only of a particular binary format, the class file format.” 1.2 The Java Virtual Machine 17
  • 18. Languages Running on the JVM Tea iScript Zigzag JESS Jickle Modula-2 Lisp Correlate Nice CAL JudoScript JavaScript Simkin Drools Basic Icon Groovy Eiffel Luck v-language Pascal Prolog Mini Tcl PLAN Hojo Scala Rexx JavaFX Script Funnel Tiger Anvil Yassl FScript Oberon E Smalltalk Logo Tiger JHCR JRuby Ada G Scheme Sather Clojure Phobos Processing WebL Dawn TermWare Sleep LLP Pnuts Bex Script BeanShell Forth PHP C# Yoix SALSA ObjectScript Jython Piccola 18 18
  • 19. InvokeDynamic Bytecode • JVM currently has four ways to invoke method > Invokevirtual, invokeinterface, invokestatic, invokespecial • All require full method signature data • InvokeDynamic will use method handle > Effectively an indirect pointer to the method • When dynamic method is first called bootstrap code determines method and creates handle • Subsequent calls simply reference defined handle • Type changes force a re-compute of the method location and an update to the handle > Method call changes are invisible to calling code 19
  • 21. invokedynamic Byte Code Call site reifies the call pink = CallSite object green = MethodHandle object 21
  • 22. JDK 7 Milestone Timeline • M5 29 Oct 2009 > Concurrency and collections updates (jsr166y) > Elliptic-curve cryptography (ECC) > JSR TBD: Small language enhancements (Project Coin) > Swing updates > Update the XML stack • M6 18 Feb 2010 • M7 15 Apr 2010 • M8 3 Jun 2010 Feature complete • M9 22 Jul 2010 • M10 9 Sep 2010 22
  • 23. More information • On OpenJDK7 • http://www.javapassion.com/javaee6/ 23
  • 24. Java EE: Past & Present Rightsizing Ease of Development Java EE 6 Web Services Pruning Java EE 5 Extensibility Robustness Profiles Enterprise Java Ease of Platform J2EE 1.4 Development Ease of Development Annotations J2EE 1.3 Web EJB Lite J2EE 1.2 Services EJB 3.0 RESTful Management CMP Persistence Services Servlet Deployment JPE Connector New and Dependency Project JSP Architecture Async. Updated Ejection EJB Connector Web Services JMS Web Profile RMI/IIOP 24
  • 25. Java EE 6 Final release December 10, 2009 25
  • 26. Java EE 5 J2EE 1.4 Java EE 5 • Deployment • Java language descriptors annotations @ • Required container • Plain Old Java Objects interfaces (POJOs) • JNDI Lookups • Dependency Injection • Deployment • More and better defaults descriptor, interfaces • No Supported UI • Java Server Faces(JSF) Framework 26
  • 27. Java EE 6 GOALS 27
  • 28. Java EE 6 Platform Goals • Rightsizing > Flexible > Lighter weight • Extensible > Embrace Open Source Frameworks • Productive > Improve on Java EE 5 28
  • 29. Rightsizing the Platform Platform Flexibility • Decouple specifications to allow more combinations • Expand potiential licensee ecosystem • Profiles > Targeted technology bundles > Web Profile 29
  • 30. About Profiles • Profiles are targeted bundles of technologies • (Simple) rules set by platform spec • Profiles can be subsets, supersets or overlapping • First profile: the Web Profile • Decoupling of specs to allow more combinations • Future profiles defined in the Java Community Process 30
  • 31. Rightsizing the Platform Web Profile • Fully functional mid-sized profile • Actively discussed > Expert Group > Industry • Technologies > Servlet 3.0, EJB Lite 3.1, JPA 2.0, JSP 2.2, EL 1.2, JSTL 1.2, JSF 2.0, JTA 1.1, JSR 45, Common Annotations 31
  • 32. Rightsizing the Platform Pruning (Deprecation) • Some technologies optional > Optional in next release > Deleted in subsequent release > Marked in Javadocs • Pruning list > JAX-RPC > EJB 2.x Entity Beans > JAXR > JSR-85 (Rules based Auth & Audit) 32
  • 33. About Pruning • Make some technologies optional • Reduce the real and conceptual footprint • Same rules as proposed by the Java SE > “pruned now, optional in the next release” • Pruned technologies will be marked in the javadocs • Current pruning list: > JAX-RPC, EJB Entity Beans, JAXR, JSR-88 33
  • 34. Rightsizing the Platform Extensibility • Embrace open source libraries and frameworks • Zero-configuration, drag-n- drop web frameworks > Servlets, servlet filters > Framework context listeners are discovered & registered • Plugin library jars using Web Fragments 34
  • 35. Ease of Development Extensibility • Continue Java EE 5 advancements • Primary focus: Web Tier • Multiple areas easier to use: EJB 3.1 • General Principles > Annotation-based programming model > Reduce or eliminate need for deployment descriptors > Traditional API for advanced users 35
  • 36. About Extensibility • Embrace open source libraries and frameworks • Zero-configuration, drag-and-drop for web frameworks > Monolithic web.xml can become complex to maintain as the dependencies of the application increases > Servlets, servlet filters, context listeners for a framework get discovered and registered automatically • Completely general solution using web fragments • Scripting languages can use the same mechanism 36
  • 37. Ease of Development • Ongoing effort • This time focus is the web tier • Lots of opportunities in other areas, e.g. EJB • General principles: > Use of annotations across all web APIs > Reduce or eliminate need for deployment descriptors – No editing of web.xml required > Self-registration of third-party libraries > Simplified packaging > JAX-RS for RESTful web services > Get technologies to work together well 37
  • 38. Java EE 6 Platform Summary 38
  • 39. Java EE 6 Platform What's New? • Several new APIs • Web Profile • Pluggability/extensibility • Dependency injection • Many improvements to APIs 39
  • 40. Java EE 6 Platform New Technologies • JAX-RS 1.1 • Bean Validation 1.0 • Dependency injection 1.0 • CDI 1.0 • Managed Beans 1.0 40
  • 41. Java EE 6 Platform Updated Technolgies • EJB 3.1 • JAX-WS 2.2 • JPA 2.0 • JSR-109 1.3 • Servlet 3.0 • JSP 2.2 • JSF 2.0 • EL 2.2 • Connectors 1.6 • JSR-250 1.1 • Interceptors 1.1 • JACC 1.4 • JASPIC 1.0 41
  • 42. Java EE 6 Samples 42
  • 43. Ease of Development Adding an EJB to a Web Application ShoppingCart BuyBooks.war EJB Class BuyBooks.war ShoppingCart.jar ShoppingCart EJB Class BuyBooks.ear 43
  • 44. Java EE Platform 5 Packaging 44
  • 45. Java EE Platform 6 Packaging 45
  • 46. Session Bean with No - Interface 46
  • 47. Ease of Development - Annotations Servlet in Java EE 5: Create two source files /* Code in Java Class */ <!--Deployment descriptor web.xml --> package com.foo; <web-app> public class MyServlet extends <servlet> HttpServlet { <servlet-name>MyServlet public void </servlet-name> doGet(HttpServletRequest <servlet-class> req,HttpServletResponse res) com.foo.MyServlet </servlet-class> { </servlet> <servlet-mapping> ... <servlet-name>MyServlet </servlet-name> } <url-pattern>/myApp/* </url-pattern> ... </servlet-mapping> ... } </web-app> 47
  • 48. Ease of Development - Annotations Servlet in Java EE 5: Java Class /* Code in Java Class */ package com.foo; public class MyServlet extends HttpServlet { public void doGet(HttpServletRequest req,HttpServletResponse res) { /* doGet body */ } } 48
  • 49. Ease of Development - Annotations Servlet in Java EE 5: Descriptor <!--Deployment descriptor web.xml --> <web-app> <servlet> <servlet-name>MyServlet </servlet-name> <servlet-class> com.foo.MyServlet </servlet-class> </servlet> <servlet-mapping> <servlet-name>MyServlet </servlet-name> <url-pattern>/myApp/* </url-pattern> </servlet-mapping> ... </web-app> 49
  • 50. Ease of Development - Annotations Java EE 6 Servlet: Single Source file (many cases) package com.foo; @WebServlet(name=”MyServlet”, urlPattern=”/myApp/*”) public class MyServlet extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse res) { ... } 50
  • 52. Demo Setup Enterprise Java JavaServer Java Beans Persistence JavaDB Faces (Business API (Database) (presentation) Logic) (Data Access) 52
  • 53. Summary • Java continues to evolve • JDK7 driving changes in the platform • JavaFX providing a RIA platform built on Java • More to come... 53
  • 54. More information • Tutorial On Java EE 6 • Webinar on Java EE 6 • http://www.javapassion.com/javaee6/ 54