This repo contains three Gradle Java projects compatible with Java 9 or above to show a very simple usage of the Module system.
The projects were created using gradle init and are:
app- the main applicationlibone- a librarylibtwo- another library
Project app depends on the two libraries and all three projects are modular since they include module-info.java files in their src/main/java directories.
- Java 9 or above installed
- Gradle installed
git clone git@github.com:twalmsley/java-modules.git
cd java-modules/libone
gradle clean build publishToMavenLocal
cd ../libtwo
gradle clean build publishToMavenLocal
cd ../app
gradle clean build runcd java-modules/app/app
./link.sh
du -sh build/jreUse gradle:
cd java-modules/app/app
gradle runOr use the command line:
cd java-modules/app/app/build/libs
export MVN_REPO=~/.m2/repository
java --module-path app.jar:$MVN_REPO/modstest/libone/1.0.1/libone-1.0.1.jar:$MVN_REPO/modstest/libtwo/1.0.1/libtwo-1.0.1.jar -m app.app.main --add-module app.app.mainOr use the custom JRE:
cd java-modules/app/build
./jre/bin/app