Java 9 Updates

Jshell

Jshell is Interactive shell. Allows us to execute java code from the shell and shows output immediately. Shell is a Read-Evaluate-Print Loop (REPL), which evaluates declarations, statements, and expressions and shows the results immediately. The tool is run from the command line.
/import --------- list of imports available
/save Test.java
/list -start ---- list of commands executed by jshell in the beginning.
/reset -- resets the jshell environment to the state at the start of the previous run of jshell.

JPMS

JPMS- Java9 Platform Module System. Now it is called a Java Module.
Modularity is result of Project Jigsaw. That helps developers at all levels be more productive as they build, maintain, and evolve software systems, especially large systems.
The primary goals of this Project were to:
  • Make it easier for developers to construct and maintain libraries and large applications.
  • Improve the security and maintainability of Java SE Platform Implementations in general, and the JDK in particular;
  • Enable improved application performance; and
  • Enable the Java SE Platform, and the JDK, to scale down for use in small computing devices and dense cloud deployments.

Java Module

Another level of encapsulation above packages.
It is a collection of reusable group of related packages as well as resources and a module descriptor(module-info.java).
Module descriptor specifies:
  • module's name
  • the module's dependencies (ie the other modules , this module depends on)
  • the packages it explicitly makes available to other modules (all the packages by default are implicitly unavailable to other modules)
  • the service it offers
  • the service it consumes
  • to what other modules it allows reflection
Key goals of JSR (Java Specification Request) for Java modules:
  • 1. Reliable configuration
  • 2. Strong Encapsulation
  • 3. Scalable Java Platform
  • 4. Greater platform integrity
  • 5. Improved Performance
syntax of module declaration
module modulename{

}