Skip to content

Files

Latest commit

0912256 · Oct 28, 2016

History

History
85 lines (49 loc) · 2.56 KB

README.md

File metadata and controls

85 lines (49 loc) · 2.56 KB

Structure

This application is a really simple password generator developed in the JDK9 modular way meaning it is composed of two modules:

  • core which provides the passwords' generator
  • fx which is the JavaFX UI which uses the core module

Prerequisites

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.

Compiling

core module

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.java

Compiled class will be available in the build/modules/io.twasyl.demo.core directory.

fx module

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.java

Compiled 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.

Bundle

core module

In order to create a modular JAR file for the core module you can execute the following command:

jar --create --file=build/libs/io.twasyl.demo.core@1.0.jar --module-version=1.0 -C build/modules/io.twasyl.demo.core .

The modular JAR file will be present in the build/libs directory.

fx module

In order to create a modular JAR file for the core module you can execute the following command:

jar --create --file=build/libs/io.twasyl.demo.fx@1.0.jar --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.

Native bundle

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 -v

You will find the bundle in the bundles/DemoFX folder.

Execution

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.fx

Or :

java -p build/libs -m io.twasyl.demo.fx