Preparation of the material was supported by the project „Increasing Internationality in Study Programs of the Department of Computer Science II“, project number VP1–2.2–ŠMM-07-K-02-070, funded by The European Social Fund Agency and the Government of Lithuania. Valdas Rapševičius Vilnius University Faculty of Mathematics and Informatics 2014.02.06 Java Technologies Lecture N 2014.02.06 Valdas Rapševičius. Java Technologies 1
24
Embed
Java Technologies. Introductionuosis.mif.vu.lt/~valdo/jate2014/JavaTech.L00.pdf · Java Platform . 1. Java 2, Standard Edition (J2SE) is designed for desktop computers. Most often
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Preparation of the material was supported by the project „Increasing Internationality in Study Programs of the Department of Computer Science II“, project number VP1–2.2–ŠMM-07-K-02-070, funded by The European Social Fund Agency and the Government of Lithuania.
• Java is generic, imperative, object-oriented, reflective programming language
• Java Technology refers to a set of several computer software products and specifications from Sun Microsystems (which has since merged with Oracle Corporation, 2010), that together provide a system for developing application software and deploying it in a cross-platform computing environment.
• Always changing … history – http://en.wikipedia.org/wiki/Java_version_history – JDK J2SE (since 1.2, JSR since 1.4) Java SE (since 6)
• Open Source?
– Sun announced in JavaOne 2006 that Java would become free and open source software – Sun released the Java HotSpot virtual machine and compiler as free software under the
GNU General Public License on November 13, 2006, with a promise that the rest of the JDK – Sun released the source code of the Class library under GPL on May 8, 2007, except some
limited parts that were licensed by Sun from 3rd parties who did not want their code to be released under a free software and open-source license.
– Sun's goal is to replace the parts that remain proprietary and closed-source with alternative implementations and make the class library completely free and open source.
1. Java 2, Standard Edition (J2SE) is designed for desktop computers. Most often it runs on top of OS X, Linux, Solaris, or Microsoft Windows
2. Java 2, Enterprise Edition (J2EE) is a comprehensive platform for multi-user, enterprise-wide applications. It is based on J2SE and adds APIs for server-side computing.
3. Java 2, Micro Edition (J2ME) is a set of technologies and specifications developed for small devices like pagers, mobile phones, and set-top boxes. J2ME uses subsets of J2SE components, such as smaller virtual machines and leaner APIs.
• Specifications for J2SE, J2EE, and J2ME are developed under the aegis of the Java Community Process (JCP).
• A specification begins with a Java Specification Request (JSR). An expert group consisting of representatives from interested companies is formed to create the specification.
• The JSR then passes through various stages in the JCP before it is finished. Every JSR is assigned a number.
• See http://jcp.org/en/home/index for everything • Sandbox: http://openjdk.java.net/
• JVM support for dynamic languages • Compressed 64-bit pointers • Project Coin:
– Strings in switch – Automatic resource management in try-statement – Improved type inference for generic instance creation – Simplified varargs method declaration – Binary integer literals – Allowing underscores in numeric literals – Catching multiple exception types and rethrowing exceptions with improved type
checking • Concurrency utilities under JSR-166 • New I/O • Library-level support for Elliptic curve cryptography algorithms • XRender pipeline for Java 2D (for modern GPUs) • New platform APIs for the graphics features • Enhanced libraries for new network protocols (SCTP and SDP) • Upstream updates to XML and Unicode
• Target release date is 2014/03/18 • EA release from:
https://jdk8.java.net/download.html • Features
– Language-level support for lambda expressions Lambda expressions enable you to treat functionality as a method argument, or code as data. They also let you express instances of single-method classes more compactly.
– Parallel Array Sorting The Fork/Join framework is used to provide a standard implementation of parallel sorting for arrays.
Compile, run tests and checks $ mvn clean test Compile, run tests, checks and package $ mvn clean package Compile code only $ mvn compile Compile tests only $ mvn test-compile Compile, run checks only $ mvn -DskipTests test Package, skip checks and tests $ mvn -DskipTests -Dcheckstyle.skip=true package Compile, run single test file $mvn -Dtest=lt.vu.mif.jate.tasks.task01.StringUtilityTest test Remove all build products $ mvn clean
• Unit testing A unit test is a piece of code written by a developer that executes a specific functionality in the code under test. Unit tests ensure that code is working as intended and validate that this is still the case after code changes.
• Unit testing with JUnit JUnit is a test framework which uses annotations to identify methods that are test methods. JUnit assumes that all test methods can be executed in an arbitrary order. Therefore tests should not depend on other tests.
• To write a test with JUnit – Annotate a method with @org.junit.Test – Use a method provided by JUnit to check the expected result of the code execution versus the actual
result – You can use Eclipse, Netbeans or the org.junit.runner.JUnitCore class to run the test.
• Example: import org.junit.Test; import static org.junit.Assert.*; public class MyUnitTest { @Test public void testConcatenate() { MyUnit myUnit = new MyUnit(); String result = myUnit.concatenate("one", "two"); assertEquals("onetwo", result); } }