Java 9 new features
The Project is split into several maven modules.
- Intro : basic Java 9 module demo.
- Address: small module required by Person
- Person: small module showing module dependency between each other
- Relect: example of open module
- Reflect: module using deep reflection to open module
- Prime: service module
- PrimeFast: provider of prime
- PrimeGeneric: provider of prime
- PrimeProbable: provider of prime
- PrimeClient: client of Prime Service
- Version: showing correct and incorrect version strings for JDK 9
- Resources: resources to be accessed from ResourceAccess module
- ResourceAccess: shows access to resources from another module
- ModuleApi: shows usage of modular API.
- ModuleAnnotation: annotated module example
- LayerInfo: module which has class printing layer info. Used in ModuleApi
- JshellDemo: module showing usage of Jshell API
- ProcessDemo: Process API examples
- CollectionsDemo: Updates to Java Collections
- HttpDemo: HTTP/2 demo usage
- StackWalking: new stackwalker api usage
- StreamDemo: Reactive streams and updates to streaming api
ModuleApi includes:
- FindModule: find module by path
- LayerTest: show layer information for required module
- LoadClass: load class from required module
- Module: print module for module and required ones
- QueryModule: check if module open and exported
- ReadModuleContents: show resources of specified module
ProcessDemo includes:
- CurrentProcessInfo: show info about current process
- Job: a job which sleeps at a regular interval up to a max duration.Interval and duration can be set as parameters on start
- StartProcess: run a new process (uses Job class)
- ProcessStats: obtain a process handle and show some stats
- ManagingProcessPermission: working with permissions
CollectionsDemo includes:
- ListDemo: new way of creating unmodifiable lists
- SetDemo: new way of creating unmodifiable sets
- MapDemo: new way of creating unmodifiable maps
StackWalking includes:
- StackWalker: shows stack walking though the stack of function calls
- GetCallerCallerClass: get the name of a class which calls a method
- PermissionCheck: instantiate stackwalker before and after installing a SecurityManager
StreamDemo includes:
- NumberPrinter: simple pub-sub usage.
- PeriodicPublisher: pulisher which publishes items periodically to custom subscribers instantiated to items
- ProcessorDemo: fitler processor usage
- StreamDemo: new streaming API features
- CollectorsDemo: new collectors features
Build and run Java 9 module:
mvn clean install
java --module-path <path-to-target>/<maven-module-name>.jar -m <jigsaw-module-name>/<package-name>.<main-class>
or if there are many modules
java --module-path <path-to-target>/<maven-module-name>.jar:<path-to-target>/<maven-module-name>.jar
-m <jigsaw-module-name>/<package-name>.<main-class>
As far as I understand one maven module can have only one java module
Classic biuld and run:
mvn clean install
java -jar <path-to-target>/<jar-name>.jar
Before build change main class name in pom for the demo you want to run