[9] review request: 8131888: Deliver javafx.swt as a modular jar in JDK 9

Mandy Chung mandy.chung at oracle.com
Fri May 27 16:58:59 UTC 2016


> On May 27, 2016, at 1:30 AM, Tom Schindl <tom.schindl at bestsolution.at> wrote:
> 
> Do you have an example how to construct such a Layer?


// path is the path to javafx-swt.jar
ModuleFinder finder = ModuleFinder.of(path);
Configuration cf = Layer.boot()
    .configuration()
    .resolveRequires(finder, ModuleFinder.of(), Set.of("javafx.swt"));

// “parent” is the class loader to which SWT types are visible
Layer layer = Layer.boot().defineModulesWithOneLoader(cf, parent);

// the class loader defining javafx.swt module
ClassLoader loader = layer.findLoader("javafx.swt”);

[1] will show more examples of Layer.
Mandy
[1] http://hg.openjdk.java.net/jdk9/dev/jdk/file/df35a805b405/test/java/lang/reflect/Layer/LayerAndLoadersTest.java



More information about the openjfx-dev mailing list