Ver la versión en Español (See Spanish version)
Examples of some of the features of Jigsaw released in the Early Access build of JDK9.
Many of the examples here are directly from the Project Jigsaw: Module System Quick-Start Guide, see http://openjdk.java.net/projects/jigsaw/quick-start but we have also contributions from the Java community.
Please note you are in the master
branch which contains exercises which need to be solved by looking at documentation or resources provided in this repo. Hints may be provided within the source or script files. If you hit a roadblock and really want to see a possible solution you can switch to the exercise-solutions
branch for that.
Looking at the solutions can take away the challenge behind solving the exercises. Stay on the master
branch in case you would like to continue to have fun solving the exercises and working through the challenges.
See Download, install and verify JDK and return to this page to continue with the rest of the steps.
- Ensure you have a
git
client installed on your local machine/VM/vagrant box, for Windows usersgit-bash
is recommended
See Download and install tree and wget and return to this page to continue with the rest of the steps.
- Alternatively a Vagrant box is available at https://github.com/ali-ince/LJC_April2017_Hackday, please make use of this facility (thanks @ali-ince).
- Install the latest IDE (IntelliJ, Eclipse, NetBeans - paid or community version) that supports JDK 9 EA, once installed configure the IDE to pickup the JDK 9 EA installed in the previous steps.
See Download, install and configure Eclipse Oxygen for JDK9.
-
Get familiar with the command-line a bit as we will be using much of it during the weekend
-
Prepare your VMs or cloud instances with the above, in case your local machine is not up for any installation or configurations
Note: the bash files provided should work on Linux and in theory on the MacOS as well.
- if you use
git-bash
(recommended) orcgywin
should work for you - run the.sh
scripts in one of the the environments. In the worst case scenario, we would have to manually convert the.sh
files into.bat
, with minor tweaks should also work there. Happy to receive a pull request for it. Or you could use bach, a platform independent Java Shell Builder. It's usage is explained insession-3-jshell
. - check if the literal JDK path (or
%JAVA_HOME%
) has been added to thePATH
environment variable or add it manually - ensure the JDK is installed in a folder where the name does not have a space in it
- in case folder name looks something
C:\Program files...
, ensure that (name does not contain spaces):- the path to the JDK in
JAVA_HOME
hasC:\Program~1
instead ofC:\Program files...
- the environment variable
PATH
refers to theJAVA_HOME
environment variable - the environment variable
CLASSPATH
refers to theJAVA_HOME
environment variable
- the path to the JDK in
- in some instances
jlink
was not yet available when JDK is installed via the.exe
file, even after the above path settings were applied (please verify beforehand)
jlink
is not yet available when JDK is installed via the.dmg
file (please verify beforehand)
Please ensure you have verified that the necessary JDK programs work in your environment with the help of the Download, install and verify JDK resource.
-
Session 1: Jigsaw Introduction
- Greetings ./session-1-jigsaw-intro/01_Greetings
- Greetings world ./session-1-jigsaw-intro/02_GreetingsWorld
- Multi-module compilation ./session-1-jigsaw-intro/03_MultiModuleCompilation
- Packaging ./session-1-jigsaw-intro/04_Packaging
- Missing requires ./session-1-jigsaw-intro/05_Missing_requires
- Missing exports ./session-1-jigsaw-intro/05_Missing_exports
- Services ./session-1-jigsaw-intro/06_Services
- javac --patch-module option ./session-1-jigsaw-intro/07_patch_module_option
- Modules export conflict ./session-1-jigsaw-intro/08_ModulesExportConflict
- Automatic modules ./session-1-jigsaw-intro/09_Automodules
-
Session 2: JLink
- JLink example ./session-2-jlink/01_JLink
- JMod example ./session-2-jlink/02_JMod
-
Session 3: JShell
- JShell quick tutorial ./session-3-jshell/
- JShell examples ./session-3-jshell/JShell-Examples
- shellFX ./session-3-jshell/shellFX/
- teamshell ./session-3-jshell/teamshell/
- bach - Java Shell Builder ./session-3-jshell/bach-building-with-jshell
-
Session 3: Refactoring/migration sessions
- Junit 5 migration to Java 9 modules ./session-3-refactoring-migration/01_junit5_to_java_9
- Building Java 9 Modules using Gradle (from monolith to modular) ./session-3-refactoring-migration/02_monolith_to_modular_using_gradle
- ServiceMonitor - Migration from Java 8 to Java 9 ./session-3-refactoring-migration/03_ServiceMonitor_migration_to_java_9
- ServiceMonitor - Modularisation to Java 9 Modules (Maven project) ./session-3-refactoring-migration/04_ServiceMonitor_modularisation_to_java_9
-
Session 4: Multirelease JARs
- Create multirelease JAR file ./session-4-multirelease-jars/01_Create_multirelease_jar/
-
Session 5: Reactive streams API
- Create Flow subscriber ./session-5-reactive-api/01_Create_subscriber/
-
Session 6: Security enhancements
- Basic ALPN ./session-6-security/01_Basic_ALPN/
- Custom ALPN ./session-6-security/02_Custom_ALPN2/
Each example is enclosed in a folder of its own containing bash scripts to compile, package and run the respective examples. Use these scripts for each of the examples.
See guidelines on how to contribute.
See License document to find out about the licensing terms and conditions.
- The State of the Module System
- JEP 261
- http://mail.openjdk.java.net/pipermail/adoption-discuss/2015-September/001053.html
- http://mail.openjdk.java.net/pipermail/adoption-discuss/2015-September/001056.html
- Module System JSR (376)
- JDK 9 / Jigsaw Resources
- Adopt OpenJDK homepage
- Adopt OpenJDK: Getting Started Kit