This application is a really simple password generator developed in the JDK9 modular way meaning it is composed of two modules:
corewhich provides the passwords' generatorfxwhich is the JavaFX UI which uses thecoremodule
In order to build the application you will need an early access build of the JDK9 with Jigsaw which can be found on the OpenJDK website.
During the demonstration the JDK 9 build 141 was used.
In order to build the core module, you can use the following command:
javac -d build/modules/io.twasyl.demo.core core/src/main/java/module-info.java core/src/main/java/io/twasyl/demo/core/Generator.javaCompiled class will be available in the build/modules/io.twasyl.demo.core directory.
In order to build the fx module, you can use the following command:
javac -d build/modules/io.twasyl.demo.fx --module-path=build/modules fx/src/main/java/io/twasyl/demo/fx/DemoFXApp.java fx/src/main/java/io/twasyl/demo/fx/controllers/DemoFXController.java fx/src/main/java/module-info.javaCompiled class will be available in the build/modules/io.twasyl.demo.fx directory.
WARNING: don't forget to manually copy the FXML and CSS files to this directory and take care to respect the package architecture of the sources.
In order to create a modular JAR file for the core module you can execute the following command:
jar --create --file=build/libs/[email protected] --module-version=1.0 -C build/modules/io.twasyl.demo.core .The modular JAR file will be present in the build/libs directory.
In order to create a modular JAR file for the core module you can execute the following command:
jar --create --file=build/libs/[email protected] --manifest=fx/src/main/resources/META-INF/MANIFEST.MF --main-class=io.twasyl.demo.fx.DemoFXApp -C build/modules/io.twasyl.demo.fx .The modular JAR file will be present in the build/libs directory.
You can create a native bundle that contains a JRE using the following command:
javapackager -deploy -native image -outdir . -outfile DemoFX -p build/libs -m io.twasyl.demo.fx -name DemoFX -vYou will find the bundle in the bundles/DemoFX folder.
If you want to execute the UI modular JAR (not the bundle), you can use the following command:
java --module-path build/libs -m io.twasyl.demo.fxOr :
java -p build/libs -m io.twasyl.demo.fx