Some fun with Project Jigsaw
- Download the early release https://jdk8.java.net/jigsaw/ (you'll want the JDK modules image)
- Read the Quick Start http://openjdk.java.net/projects/jigsaw/doc/quickstart.html
- Ensure you either put the jigsaw bin directory on your path or use fully qualified file paths to the executables.
Easy Running the example code:
- Create a module library directory by running:
jmod -L moduleLib create
- Install the prebuilt modules by running:
jmod -L moduleLib install modules/com.bobpaulin.apache.jigsaw@0.1.jmod modules/org.apache.commons.lang3@3.3.1.jmod
- Run the Demo Code:
java -L moduleLib -m com.bobpaulin.apache.jigsaw
A little more fun. Compile the modules from scratch:
- Create a module library directory by running (if you did the example from before delete moduleLib directory):
jmod -L moduleLib create
- Compile Apache Commons Lib
javac -d modules/org.apache.commons.lang3 -sourcepath common-lang-jigsaw `find common-lang-jigsaw/src/main/java -name '*.java'`
- Install Apache Commons Lib
jmod -L moduleLib install modules org.apache.commons.lang3
- Compile Demo Code:
javac.exe -d modules/com.bobpaulin.apache.jigsaw -sourcepath com.bobpaulin.apache.jigsaw `find com.bobpaulin.apache.jigsaw/src -name '*.java'`
- Install Demo Code
jmod -L moduleLib install modules com.bobpaulin.apache.jigsaw
- Run Demo Code
java -L moduleLib -m com.bobpaulin.apache.jigsaw
Extra Credit:
- Packaging built modules by running:
jpkg -m modules/com.bobpaulin.apache.jigsaw jmod com.bobpaulin.apache.jigsaw
jpkg -m modules/org.apache.commons.lang3 jmod org.apache.commons.lang3
MORE EXTRA Credit:
- Create a new bundle of an Open Source Library by creating a module-info.java in the source root:
module org.apache.commons.lang3 @ 3.3.1 {
exports org.apache.commons.lang3;
}