Written by Martin Lehmann, Kristine Schaal and Rüdiger Grammes
see https://github.com/accso/java9-jigsaw-examples
This is a example suite for Java 9 jigsaw modules. Many aspects of the new Java 9 Jigsaw modules as defined in Project Jigsaw by JSR 376 and JEP 261.
- Clone this repo.
- Install a Java 9 JDK with Jigsaw support. All examples have been tested with J9 build b162 (as of end of March 2017) on Windows 10, x64.
- Install GraphViz 2.38.
- Install Maven 3.3.9. Note that this is needed for example_maven_blackbox and example_maven_whitebox only.
- If running on Windows, install a bash, like for example Babun
- To generate the graphviz graphs, you also need to clone and compile depvis.
- Edit file
env.sh
to configureJAVA_HOME
andGRAPHVIZ_HOME
andMAVEN_HOME
andDEPVIS_HOME
(see TODO markers) - Also edit file
env.sh
to configure the path separator. If run on Windows, use ; (a blackslash quoting a ;). If you run all stuff on *nix, use a colon : . - Call one of the scripts on the top level, i.e. one of
allclean.sh
,allcompile.sh
,allcreatevis.sh
andallrun.sh
(orall.sh
for all in one step). - Alternatively, cd to one of the examples and call one of the scripts there (again
all.sh
for all in one step).
- Scripts in top level directory all*.sh call the corresponding scripts recursively
- Scripts in each example are all.sh, clean.sh, compile*.sh, run*.sh
- Script createvis.sh in each example creates a GraphViz visualiation, see https://github.com/accso/java9-jigsaw-depvis
- Eclipse project files are included. Per convention: one module == one Eclipse project. Putting them all in one workspace will not work, because their names, i.e. Eclipse project names, do overlap which is not allowed in one workspace.
- Source files are in
example_.../src
. That's the module-source-path. - Compiled .class files go to
example_.../mods
. - JAR files go to
example_.../mlib
. That's the module-path when run. - Third-party JAR files are in
example_.../amlib
. That's also the module-path, in this case containing automatic modules. - A few examples do compile "old-style" without modules. Results go to
example_.../classes
. - If a module is patched, then the .class files for the patch are in
example_.../patches
. Corresponding JAR files are inexample_.../patchlib
.
No software is ready, ever ;-) So here are some ideas left (any other feedback very welcome!):
- Do a bit of renaming and refactoring of module names. (modmain had been moda before, so that's why most modules are called modb, modc, ...)
- add new example on annotation and deprecation of modules
- example for open modules
- changes in API (java.lang.reflect.Module is now java.lang.Module, java.lang.reflect.Layer is now java.lang.ModuleLayer)
- changes in API (Configuration.resolve instead of Configuration.resolveRequires)
- no more java.compact1 profile available (was used in example_resolved-modules)
- all javac calls now use -Xlint
- note that compiler and launcher now show various warnings (not sure if this is because of b156 or because of "javac -Xlint")
- no changes necessary, everything seems still to work as in b144
- "opens" instead of "exports dynamic" and "weak modules"
- "requires transitive" instead of "requires public"
DepVis, see https://github.com/accso/java9-jigsaw-depvis : Visualization tool for Jigsaw modules