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.
- 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.
- 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.
-
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.
For Windows users, if you use git-bash
(recommended) or cgywin
they should work for you.
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 received a pull request for it.
-
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/
-
Session 4: Refactoring/migration sessions
- Junit 5 migration to Java 9 modules ./session-4-refactoring-migration/01_junit5_to_java_9
- Building Java 9 Modules using Gradle (from monolith to modular) ./session-4-refactoring-migration/02_monolith_to_modular_using_gradle
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.
- 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