SlideShare une entreprise Scribd logo
1  sur  57
Télécharger pour lire hors ligne
Moving to Module
Issues & Solutions
Project Jigsaw
Java in the Box
Yuichi Sakuraba
Module
Issues of Non-Modular Software
Issues of Modular Software
Motivation
-classpath
rt.jar
-classpath Issues
public is TOO Public
TOO Many Libraries
Which Libs Use which Libs?
Want to Hide “public” Class
rt.jar Issue
rt.jar
(Java SE 8)
Standard Library is TOO Huge
-classpath Issues
rt.jar Issue
Introduce Module
{ }Dependency
Disclosure Scope
Divide into Modules
According to Features
Module
JAR
module-info.java
Dependency
Disclosure Scope
Build
javac --module-path [directory] [source file]
-p
or
jar --create --file [JAR filename] 
-C [class file directory] .
Build
javac --module-path [directory] [source file]
-p
or
jar --create --file [JAR filename] 
-C [class file directory] .
Execution
java -p [directory] 
--module [module]/[main class]
-m
or
java -p mods 
-m net.javainthebox.jigsawsample/net.javainthebox.sample.Main
jigsawsample
java -p mods 
-m net.javainthebox.jigsawsample/net.javainthebox.sample.Main
jigsawsample
javafx.media
javafx.controls
java -p mods 
-m net.javainthebox.jigsawsample/net.javainthebox.sample.Main
jigsawsample
javafx.media
javafx.controls
javafx.graphics
javafx.base
java -p mods 
-m net.javainthebox.jigsawsample/net.javainthebox.sample.Main
jigsawsample
javafx.media
javafx.controls
javafx.graphics
javafx.base
java.desktop
java.xml
jdk.jsobject
......
......
......
Tool Support
IDE IntelliJ IDEA
Eclipse
NetBeans
Only Nightly Build
Tool Support
IDE IntelliJ IDEA
Eclipse
NetBeans
Only Nightly Build
Build Tool Maven
Gradle
Need to Write Options
in Build File
jdeps Tool to Check Dependency
jdeps Tool to Check Dependency
C:samplemods>jdeps -s jigsawsample.jar
jigsawsample.jar -> java.base
jigsawsample.jar -> java.logging
jigsawsample.jar -> java.xml
jigsawsample.jar -> javafx.base
jigsawsample.jar -> javafx.controls
jigsawsample.jar -> javafx.graphics
jigsawsample.jar -> javafx.media
jdeps Tool to Check Dependency
C:samplemods>jdeps --generate-module-info . 
jigsawsample.jar
writing to .jigsawsamplemodule-info.java
module jigsawsample {
requires java.logging;
requires javafx.base;
requires javafx.controls;
requires javafx.media;
requires transitive java.xml;
requires transitive javafx.graphics;
exports net.javainthebox.sample;
exports net.javainthebox.sample.internal;
}
jdeps Tool to Check Dependency
C:samplemods>jdeps --generate-module-info . 
jigsawsample.jar
writing to .jigsawsamplemodule-info.java
module jigsawsample {
requires java.logging;
requires javafx.base;
requires javafx.controls;
requires javafx.media;
requires transitive java.xml;
requires transitive javafx.graphics;
exports net.javainthebox.sample;
exports net.javainthebox.sample.internal;
}
Edit as Necessary
Issues of
Non-Modular Software
Non-Disclosure API
Non-Standard Module
import com.sun.javafx.tk.FontMetrics;
import com.sun.javafx.tk.Toolkit;
import javafx.scene.text.Font;
public class FontSample {
public static void main(String... args) {
Font font = Font.font(24);
Toolkit toolkit = Toolkit.getToolkit();
FontMetrics metrics
= toolkit.getFontLoader().getFontMetrics(font);
System.out.println(metrics.getLineHeight());
}
}
C:fxsample>javac FontSample.java
FontSample.java:1: error: package com.sun.javafx.tk is not
visible
import com.sun.javafx.tk.FontMetrics;
^
(package com.sun.javafx.tk is declared in module javafx.
graphics, which does not export it to the unnamed module)
FontSample.java:2: error: package com.sun.javafx.tk is not
visible
import com.sun.javafx.tk.Toolkit;
^
(package com.sun.javafx.tk is declared in module javafx.
graphics, which does not export it to the unnamed module)
2 errors
import com.sun.javafx.tk.FontMetrics;
import com.sun.javafx.tk.Toolkit;
import javafx.scene.text.Font;
public class FontSample {
public static void main(String... args) {
Font font = Font.font(24);
Toolkit toolkit = Toolkit.getToolkit();
FontMetrics metrics
= toolkit.getFontLoader().getFontMetrics(font);
System.out.println(metrics.getLineHeight());
}
}
Non-Disclosure API
Non Exported Packages
com.sun...
sun...
java.awt.peer
Non-Disclosure API
Non Exported Packages
com.sun...
sun...
java.awt.peer
Exceptional API
sun.misc.Unsafe
sun.reflect.Reflection
(Remove in Future)
Solution
add export by
--add-exports option
--add-exports module/package=target
javac
java
Solution
add export by
--add-exports option
--add-exports module/package=target
javac
java
when non-modular system
target is ALL-UNNAMED
ex.
javac --add-exports javafx.graphics/com.sun.javafx.tk=ALL-UNNAMED 
FontSample.java
public class FontSample {
public static void main(String... args) throws Exception {
Font font = Font.font(24);
FontMetrics metrics
= Toolkit.getToolkit().getFontLoader().getFontMetrics(font);
Class<FontMetrics> metricsClass = FontMetrics.class;
Field lineHeight
= metricsClass.getDeclaredField("lineHeight");
lineHeight.setAccessible(true);
System.out.println(lineHeight.getFloat(metrics));
}
}
C:fxsample>javac --add-exports 
javafx.graphics/com.sun.javafx.tk=ALL-UNNAMED 
FontSample.java
C:fxsample>java --add-exports 
javafx.graphics/com.sun.javafx.tk=ALL-UNNAMED FontSample
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by FontSample (file:/C:/fxsa
mple/) to field com.sun.javafx.tk.FontMetrics.lineHeight
WARNING: Please consider reporting this to the maintainers of
FontSample
WARNING: Use --illegal-access=warn to enable warnings of
further illegal reflective access operations
WARNING: All illegal access operations will be denied in a futu
re release
31.921875
public class FontSample {
public static void main(String... args) throws Exception {
Font font = Font.font(24);
FontMetrics metrics
= Toolkit.getToolkit().getFontLoader().getFontMetrics(font);
Class<FontMetrics> metricsClass = FontMetrics.class;
Field lineHeight
= metricsClass.getDeclaredField("lineHeight");
lineHeight.setAccessible(true);
System.out.println(lineHeight.getFloat(metrics));
}
}
Non-Disclosure API
Reflection
Reflective access to public
--add-exports
Non-Disclosure API
Reflection
Reflective access to public
--add-exports
Reflective access to non-public
--add-opens in execution
using setAccessible(true)
ex.
java --add-opens javafx.graphics/com.sun.javafx.tk=ALL-UNNAMED 
FontSample.java
import java.io.File;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import net.javainthebox.xml.Name;
public class JAXBSample {
public static void main(String... args) throws JAXBException {
JAXBContext context
= JAXBContext.newInstance("net.javainthebox.xml");
Unmarshaller unmarshaller = context.createUnmarshaller();
File file = new File("sakuraba.xml");
Name sakuraba = (Name)unmarshaller.unmarshal(file);
System.out.println(sakuraba.getFirst()
+ " " + sakuraba.getLast());
}
}
C:jaxbsample>javac JAXBSample.java
netjavaintheboxxmlName.java:11: error: package javax.xml.
bind.annotation is not visible
import javax.xml.bind.annotation.XmlAccessType;
^
(package javax.xml.bind.annotation is declared in module
java.xml.bind, which is not in the module graph)
<<skip the rest>>
import java.io.File;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import net.javainthebox.xml.Name;
public class JAXBSample {
public static void main(String... args) throws JAXBException {
JAXBContext context
= JAXBContext.newInstance("net.javainthebox.xml");
Unmarshaller unmarshaller = context.createUnmarshaller();
File file = new File("sakuraba.xml");
Name sakuraba = (Name)unmarshaller.unmarshal(file);
System.out.println(sakuraba.getFirst()
+ " " + sakuraba.getLast());
}
}
Non-Standard Module
Modules not included
in standard modulepath
Non-Standard Module
Modules not included
in standard modulepath
JAXB
JAX-WS
CORBA
java.xml.bind
java.xml.ws
java.corba
These modules will be removed in future
You should use the modules supplied by Java EE
Non-Standard Module
Modules not included
in standard modulepath
JAXB
JAX-WS
CORBA
java.xml.bind
java.xml.ws
java.corba
These modules will be removed in future
You should use the modules supplied by Java EE
Incubator jdk.incubator.httpclient
Solution
Add Modules by
--add-modules option
--add-modules module
javac
java
ex)
java --add-modules java.xml.bind JAXBSample
Issues of
Modular Software
modulepath
classpath
In Java SE 8, Only classpath is Used
In Java SE 8, Only classpath is Used
Module and Non-Module are Used
In Java SE 9,
modulepath classpath
In Java SE 8, Only classpath is Used
Module and Non-Module are Used
In Java SE 9,
modulepath classpath
specified in module-info.java
Module CAN Access Only Modules
foo.jar bar.jarmyapp.jar
Module Non-Module
foo.jar bar.jarmyapp.jar
Module Non-Module
Access Directly: Automatic Module
Access Indirectly: Unnamed Module
foo.jar bar.jarmyapp.jar
Module Non-Module
Access Directly: Automatic Module
Access Indirectly: Unnamed Module
Automatic Unnamed
foo.jar bar.jarmyapp.jar
Module Non-Module
Automatic Unnamed
modulepath classpath
foo.jar bar.jarmyapp.jar
Module Non-Module
Automatic Unnamed
modulepath classpath
Automatic Module: Named Module
Unnamed Module: No Name Modu
MANIFEST.MF Automatic-Module-Name
or JAR filename
Automatic Module Name is Defined by
foo.jar bar.jarmyapp.jar
Module Non-Module
Automatic Unnamed
modulepath classpath
module myapp {
requires foo;
}
> java -cp bar.jar -p mod 
-m myapp/myapp.Main
foo.jar bar.jarmyapp.jar
java.xml.bind
Module Non-Module
Automatic Module Can’
Describe Dependency
t
foo.jar bar.jarmyapp.jar
java.xml.bind
Module Non-Module
Automatic Module Can’
Describe Dependency
t
> java -cp bar.jar -p mods 
--add-modules java.xml.bind 
-m myapp/myapp.Main
foo.jar bar.jarmyapp.jar
java.xml.bind
Module Non-Module
Automatic Module Can’
Describe Dependency
t
> java -cp bar.jar -p mods 
--add-modules java.xml.bind 
-m myapp/myapp.Main
> java -cp bar.jar -p mods 
--add-modules ALL-MODULE-PATH 
-m myapp/myapp.Main
If You Don’ t Know Dependencies
Conclusion
Non-Disclosure API
Issues of Non-Modular Software
Non-Standard Module
May Remove These APIs/Modules in Future
modulepath & classpath
Issues of Modular Software
May Use Only modulepath in Future??
Moving to Module
Issues & Solutions
Project Jigsaw
Java in the Box
Yuichi Sakuraba

Contenu connexe

Tendances

Whats New in Java 5, 6, & 7 (Webinar Presentation - June 2013)
Whats New in Java 5, 6, & 7 (Webinar Presentation - June 2013)Whats New in Java 5, 6, & 7 (Webinar Presentation - June 2013)
Whats New in Java 5, 6, & 7 (Webinar Presentation - June 2013)DevelopIntelligence
 
Java7 New Features and Code Examples
Java7 New Features and Code ExamplesJava7 New Features and Code Examples
Java7 New Features and Code ExamplesNaresh Chintalcheru
 
When and How Using Structural Information to Improve IR-Based Traceability Re...
When and How Using Structural Information to Improve IR-Based Traceability Re...When and How Using Structural Information to Improve IR-Based Traceability Re...
When and How Using Structural Information to Improve IR-Based Traceability Re...Annibale Panichella
 
Scala For Java Programmers
Scala For Java ProgrammersScala For Java Programmers
Scala For Java ProgrammersEnno Runne
 
Advance Java Programs skeleton
Advance Java Programs skeletonAdvance Java Programs skeleton
Advance Java Programs skeletonIram Ramrajkar
 
More topics on Java
More topics on JavaMore topics on Java
More topics on JavaAhmed Misbah
 
New Features Of JDK 7
New Features Of JDK 7New Features Of JDK 7
New Features Of JDK 7Deniz Oguz
 
Synapseindia reviews.odp.
Synapseindia reviews.odp.Synapseindia reviews.odp.
Synapseindia reviews.odp.Tarunsingh198
 
Java Interview Questions Answers Guide
Java Interview Questions Answers GuideJava Interview Questions Answers Guide
Java Interview Questions Answers GuideDaisyWatson5
 
66781291 java-lab-manual
66781291 java-lab-manual66781291 java-lab-manual
66781291 java-lab-manualLaura Popovici
 
Core Java- An advanced review of features
Core Java- An advanced review of featuresCore Java- An advanced review of features
Core Java- An advanced review of featuresvidyamittal
 
PROGRAMMING IN JAVA-unit 3-part II
PROGRAMMING IN JAVA-unit 3-part IIPROGRAMMING IN JAVA-unit 3-part II
PROGRAMMING IN JAVA-unit 3-part IISivaSankari36
 

Tendances (20)

Spock
SpockSpock
Spock
 
Whats New in Java 5, 6, & 7 (Webinar Presentation - June 2013)
Whats New in Java 5, 6, & 7 (Webinar Presentation - June 2013)Whats New in Java 5, 6, & 7 (Webinar Presentation - June 2013)
Whats New in Java 5, 6, & 7 (Webinar Presentation - June 2013)
 
Java7 New Features and Code Examples
Java7 New Features and Code ExamplesJava7 New Features and Code Examples
Java7 New Features and Code Examples
 
When and How Using Structural Information to Improve IR-Based Traceability Re...
When and How Using Structural Information to Improve IR-Based Traceability Re...When and How Using Structural Information to Improve IR-Based Traceability Re...
When and How Using Structural Information to Improve IR-Based Traceability Re...
 
Scala For Java Programmers
Scala For Java ProgrammersScala For Java Programmers
Scala For Java Programmers
 
Clojure: a LISP for the JVM
Clojure: a LISP for the JVMClojure: a LISP for the JVM
Clojure: a LISP for the JVM
 
Advance Java Programs skeleton
Advance Java Programs skeletonAdvance Java Programs skeleton
Advance Java Programs skeleton
 
Java 9 Features
Java 9 FeaturesJava 9 Features
Java 9 Features
 
Java SE 8 best practices
Java SE 8 best practicesJava SE 8 best practices
Java SE 8 best practices
 
More topics on Java
More topics on JavaMore topics on Java
More topics on Java
 
New Features Of JDK 7
New Features Of JDK 7New Features Of JDK 7
New Features Of JDK 7
 
Synapseindia reviews.odp.
Synapseindia reviews.odp.Synapseindia reviews.odp.
Synapseindia reviews.odp.
 
Java Interview Questions Answers Guide
Java Interview Questions Answers GuideJava Interview Questions Answers Guide
Java Interview Questions Answers Guide
 
Java programming-examples
Java programming-examplesJava programming-examples
Java programming-examples
 
Java Concurrency by Example
Java Concurrency by ExampleJava Concurrency by Example
Java Concurrency by Example
 
66781291 java-lab-manual
66781291 java-lab-manual66781291 java-lab-manual
66781291 java-lab-manual
 
Core Java- An advanced review of features
Core Java- An advanced review of featuresCore Java- An advanced review of features
Core Java- An advanced review of features
 
Java tutorials
Java tutorialsJava tutorials
Java tutorials
 
PROGRAMMING IN JAVA-unit 3-part II
PROGRAMMING IN JAVA-unit 3-part IIPROGRAMMING IN JAVA-unit 3-part II
PROGRAMMING IN JAVA-unit 3-part II
 
Basic java for Android Developer
Basic java for Android DeveloperBasic java for Android Developer
Basic java for Android Developer
 

Similaire à Moving to Module: Issues & Solutions

Soft-Shake 2016 : Jigsaw est prêt à tuer le classpath
Soft-Shake 2016 : Jigsaw  est prêt à tuer le classpathSoft-Shake 2016 : Jigsaw  est prêt à tuer le classpath
Soft-Shake 2016 : Jigsaw est prêt à tuer le classpathAlexis Hassler
 
LausanneJUG 2017 - Jigsaw est prêt à tuer le classpath
LausanneJUG 2017 - Jigsaw est prêt à tuer le classpathLausanneJUG 2017 - Jigsaw est prêt à tuer le classpath
LausanneJUG 2017 - Jigsaw est prêt à tuer le classpathAlexis Hassler
 
Java programming basics
Java programming basicsJava programming basics
Java programming basicsHamid Ghorbani
 
NJB_Coll_Lib1javadocallclasses-frame.htmlAll ClassesDynamicArr.docx
NJB_Coll_Lib1javadocallclasses-frame.htmlAll ClassesDynamicArr.docxNJB_Coll_Lib1javadocallclasses-frame.htmlAll ClassesDynamicArr.docx
NJB_Coll_Lib1javadocallclasses-frame.htmlAll ClassesDynamicArr.docxcurwenmichaela
 
LyonJUG : Comment Jigsaw est prêt à tuer le classpath
LyonJUG : Comment Jigsaw est prêt à tuer le classpathLyonJUG : Comment Jigsaw est prêt à tuer le classpath
LyonJUG : Comment Jigsaw est prêt à tuer le classpathAlexis Hassler
 
LyonJUG : Comment Jigsaw est prêt à tuer le classpath
LyonJUG : Comment Jigsaw est prêt à tuer le classpath LyonJUG : Comment Jigsaw est prêt à tuer le classpath
LyonJUG : Comment Jigsaw est prêt à tuer le classpath Alexis Hassler
 
Java 9 Module System
Java 9 Module SystemJava 9 Module System
Java 9 Module SystemHasan Ünal
 
Java Programming and J2ME: The Basics
Java Programming and J2ME: The BasicsJava Programming and J2ME: The Basics
Java Programming and J2ME: The Basicstosine
 
Migrating to java 9 modules
Migrating to java 9 modulesMigrating to java 9 modules
Migrating to java 9 modulesPaul Bakker
 
Java 9: Deep Dive into Modularity and Dealing with Migration Issues
Java 9: Deep Dive into Modularity and Dealing with Migration IssuesJava 9: Deep Dive into Modularity and Dealing with Migration Issues
Java 9: Deep Dive into Modularity and Dealing with Migration IssuesGlobalLogic Ukraine
 
ElsassJUG - Le classpath n'est pas mort...
ElsassJUG - Le classpath n'est pas mort...ElsassJUG - Le classpath n'est pas mort...
ElsassJUG - Le classpath n'est pas mort...Alexis Hassler
 
Advance java kvr -satya
Advance java  kvr -satyaAdvance java  kvr -satya
Advance java kvr -satyaSatya Johnny
 
Modern Java Workshop
Modern Java WorkshopModern Java Workshop
Modern Java WorkshopSimon Ritter
 
Eric Lafortune - The Jack and Jill build system
Eric Lafortune - The Jack and Jill build systemEric Lafortune - The Jack and Jill build system
Eric Lafortune - The Jack and Jill build systemGuardSquare
 

Similaire à Moving to Module: Issues & Solutions (20)

Soft-Shake 2016 : Jigsaw est prêt à tuer le classpath
Soft-Shake 2016 : Jigsaw  est prêt à tuer le classpathSoft-Shake 2016 : Jigsaw  est prêt à tuer le classpath
Soft-Shake 2016 : Jigsaw est prêt à tuer le classpath
 
LausanneJUG 2017 - Jigsaw est prêt à tuer le classpath
LausanneJUG 2017 - Jigsaw est prêt à tuer le classpathLausanneJUG 2017 - Jigsaw est prêt à tuer le classpath
LausanneJUG 2017 - Jigsaw est prêt à tuer le classpath
 
Migrating to Java 9 Modules
Migrating to Java 9 ModulesMigrating to Java 9 Modules
Migrating to Java 9 Modules
 
Java programming basics
Java programming basicsJava programming basics
Java programming basics
 
Java9
Java9Java9
Java9
 
NJB_Coll_Lib1javadocallclasses-frame.htmlAll ClassesDynamicArr.docx
NJB_Coll_Lib1javadocallclasses-frame.htmlAll ClassesDynamicArr.docxNJB_Coll_Lib1javadocallclasses-frame.htmlAll ClassesDynamicArr.docx
NJB_Coll_Lib1javadocallclasses-frame.htmlAll ClassesDynamicArr.docx
 
Java Quiz - Meetup
Java Quiz - MeetupJava Quiz - Meetup
Java Quiz - Meetup
 
LyonJUG : Comment Jigsaw est prêt à tuer le classpath
LyonJUG : Comment Jigsaw est prêt à tuer le classpathLyonJUG : Comment Jigsaw est prêt à tuer le classpath
LyonJUG : Comment Jigsaw est prêt à tuer le classpath
 
LyonJUG : Comment Jigsaw est prêt à tuer le classpath
LyonJUG : Comment Jigsaw est prêt à tuer le classpath LyonJUG : Comment Jigsaw est prêt à tuer le classpath
LyonJUG : Comment Jigsaw est prêt à tuer le classpath
 
02 basic java programming and operators
02 basic java programming and operators02 basic java programming and operators
02 basic java programming and operators
 
Java 9 Module System
Java 9 Module SystemJava 9 Module System
Java 9 Module System
 
Java Programming - 05 access control in java
Java Programming - 05 access control in javaJava Programming - 05 access control in java
Java Programming - 05 access control in java
 
Java Programming and J2ME: The Basics
Java Programming and J2ME: The BasicsJava Programming and J2ME: The Basics
Java Programming and J2ME: The Basics
 
Migrating to java 9 modules
Migrating to java 9 modulesMigrating to java 9 modules
Migrating to java 9 modules
 
Java 9: Deep Dive into Modularity and Dealing with Migration Issues
Java 9: Deep Dive into Modularity and Dealing with Migration IssuesJava 9: Deep Dive into Modularity and Dealing with Migration Issues
Java 9: Deep Dive into Modularity and Dealing with Migration Issues
 
ElsassJUG - Le classpath n'est pas mort...
ElsassJUG - Le classpath n'est pas mort...ElsassJUG - Le classpath n'est pas mort...
ElsassJUG - Le classpath n'est pas mort...
 
Adv kvr -satya
Adv  kvr -satyaAdv  kvr -satya
Adv kvr -satya
 
Advance java kvr -satya
Advance java  kvr -satyaAdvance java  kvr -satya
Advance java kvr -satya
 
Modern Java Workshop
Modern Java WorkshopModern Java Workshop
Modern Java Workshop
 
Eric Lafortune - The Jack and Jill build system
Eric Lafortune - The Jack and Jill build systemEric Lafortune - The Jack and Jill build system
Eric Lafortune - The Jack and Jill build system
 

Plus de Yuichi Sakuraba

Vector API - Javaによるベクターコンピューティング
Vector API - JavaによるベクターコンピューティングVector API - Javaによるベクターコンピューティング
Vector API - JavaによるベクターコンピューティングYuichi Sakuraba
 
Oracle Code One - Java KeynoteとJava SE
Oracle Code One - Java KeynoteとJava SEOracle Code One - Java KeynoteとJava SE
Oracle Code One - Java KeynoteとJava SEYuichi Sakuraba
 
Project Loom + Project Panama
Project Loom + Project PanamaProject Loom + Project Panama
Project Loom + Project PanamaYuichi Sakuraba
 
Project Loom - 限定継続と軽量スレッド -
Project Loom - 限定継続と軽量スレッド - Project Loom - 限定継続と軽量スレッド -
Project Loom - 限定継続と軽量スレッド - Yuichi Sakuraba
 
Oracle Code One 報告会 Java SE Update
Oracle Code One 報告会 Java SE UpdateOracle Code One 報告会 Java SE Update
Oracle Code One 報告会 Java SE UpdateYuichi Sakuraba
 
今こそStream API入門
今こそStream API入門今こそStream API入門
今こそStream API入門Yuichi Sakuraba
 
Oracle Code One 報告会 Java SE Update
Oracle Code One 報告会 Java SE UpdateOracle Code One 報告会 Java SE Update
Oracle Code One 報告会 Java SE UpdateYuichi Sakuraba
 
Learn Language 2018 Java Language Update
Learn Language 2018 Java Language Update Learn Language 2018 Java Language Update
Learn Language 2018 Java Language Update Yuichi Sakuraba
 
Dockerに向けて、Javaもダイエット
Dockerに向けて、JavaもダイエットDockerに向けて、Javaもダイエット
Dockerに向けて、JavaもダイエットYuichi Sakuraba
 
Migration Guide to Java SE 10, and also Java SE 11
Migration Guide to Java SE 10, and also Java SE 11Migration Guide to Java SE 10, and also Java SE 11
Migration Guide to Java SE 10, and also Java SE 11Yuichi Sakuraba
 
琥珀色のJava - Project Amber -
琥珀色のJava - Project Amber -琥珀色のJava - Project Amber -
琥珀色のJava - Project Amber -Yuichi Sakuraba
 
モジュール移行の課題と対策
モジュール移行の課題と対策モジュール移行の課題と対策
モジュール移行の課題と対策Yuichi Sakuraba
 
Project Jigsawと、ちょっとだけVector API
Project Jigsawと、ちょっとだけVector APIProject Jigsawと、ちょっとだけVector API
Project Jigsawと、ちょっとだけVector APIYuichi Sakuraba
 
Java SEの現在、過去 そして未来
Java SEの現在、過去 そして未来Java SEの現在、過去 そして未来
Java SEの現在、過去 そして未来Yuichi Sakuraba
 
Introduction of Project Jigsaw
Introduction of Project JigsawIntroduction of Project Jigsaw
Introduction of Project JigsawYuichi Sakuraba
 
Encouragement of Java SE 9
Encouragement of Java SE 9Encouragement of Java SE 9
Encouragement of Java SE 9Yuichi Sakuraba
 

Plus de Yuichi Sakuraba (20)

Vector API - Javaによるベクターコンピューティング
Vector API - JavaによるベクターコンピューティングVector API - Javaによるベクターコンピューティング
Vector API - Javaによるベクターコンピューティング
 
Oracle Code One - Java KeynoteとJava SE
Oracle Code One - Java KeynoteとJava SEOracle Code One - Java KeynoteとJava SE
Oracle Code One - Java KeynoteとJava SE
 
Project Loom + Project Panama
Project Loom + Project PanamaProject Loom + Project Panama
Project Loom + Project Panama
 
Project Loom - 限定継続と軽量スレッド -
Project Loom - 限定継続と軽量スレッド - Project Loom - 限定継続と軽量スレッド -
Project Loom - 限定継続と軽量スレッド -
 
Oracle Code One 報告会 Java SE Update
Oracle Code One 報告会 Java SE UpdateOracle Code One 報告会 Java SE Update
Oracle Code One 報告会 Java SE Update
 
今こそStream API入門
今こそStream API入門今こそStream API入門
今こそStream API入門
 
Oracle Code One 報告会 Java SE Update
Oracle Code One 報告会 Java SE UpdateOracle Code One 報告会 Java SE Update
Oracle Code One 報告会 Java SE Update
 
Learn Language 2018 Java Language Update
Learn Language 2018 Java Language Update Learn Language 2018 Java Language Update
Learn Language 2018 Java Language Update
 
Dockerに向けて、Javaもダイエット
Dockerに向けて、JavaもダイエットDockerに向けて、Javaもダイエット
Dockerに向けて、Javaもダイエット
 
What's New in Java
What's New in JavaWhat's New in Java
What's New in Java
 
Migration Guide to Java SE 10, and also Java SE 11
Migration Guide to Java SE 10, and also Java SE 11Migration Guide to Java SE 10, and also Java SE 11
Migration Guide to Java SE 10, and also Java SE 11
 
琥珀色のJava - Project Amber -
琥珀色のJava - Project Amber -琥珀色のJava - Project Amber -
琥珀色のJava - Project Amber -
 
モジュール移行の課題と対策
モジュール移行の課題と対策モジュール移行の課題と対策
モジュール移行の課題と対策
 
Project Jigsawと、ちょっとだけVector API
Project Jigsawと、ちょっとだけVector APIProject Jigsawと、ちょっとだけVector API
Project Jigsawと、ちょっとだけVector API
 
Java SE 9の全貌
Java SE 9の全貌Java SE 9の全貌
Java SE 9の全貌
 
Java SEの現在、過去 そして未来
Java SEの現在、過去 そして未来Java SEの現在、過去 そして未来
Java SEの現在、過去 そして未来
 
Java SE 9 のススメ
Java SE 9 のススメJava SE 9 のススメ
Java SE 9 のススメ
 
Introduction of Project Jigsaw
Introduction of Project JigsawIntroduction of Project Jigsaw
Introduction of Project Jigsaw
 
Encouragement of Java SE 9
Encouragement of Java SE 9Encouragement of Java SE 9
Encouragement of Java SE 9
 
Javaで和暦と元号
Javaで和暦と元号Javaで和暦と元号
Javaで和暦と元号
 

Dernier

Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 

Dernier (20)

Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 

Moving to Module: Issues & Solutions

  • 1. Moving to Module Issues & Solutions Project Jigsaw Java in the Box Yuichi Sakuraba
  • 2. Module Issues of Non-Modular Software Issues of Modular Software
  • 5. -classpath Issues public is TOO Public TOO Many Libraries Which Libs Use which Libs? Want to Hide “public” Class
  • 6. rt.jar Issue rt.jar (Java SE 8) Standard Library is TOO Huge
  • 7. -classpath Issues rt.jar Issue Introduce Module { }Dependency Disclosure Scope Divide into Modules According to Features
  • 8.
  • 10. Build javac --module-path [directory] [source file] -p or jar --create --file [JAR filename] -C [class file directory] .
  • 11. Build javac --module-path [directory] [source file] -p or jar --create --file [JAR filename] -C [class file directory] . Execution java -p [directory] --module [module]/[main class] -m or
  • 12. java -p mods -m net.javainthebox.jigsawsample/net.javainthebox.sample.Main jigsawsample
  • 13. java -p mods -m net.javainthebox.jigsawsample/net.javainthebox.sample.Main jigsawsample javafx.media javafx.controls
  • 14. java -p mods -m net.javainthebox.jigsawsample/net.javainthebox.sample.Main jigsawsample javafx.media javafx.controls javafx.graphics javafx.base
  • 15. java -p mods -m net.javainthebox.jigsawsample/net.javainthebox.sample.Main jigsawsample javafx.media javafx.controls javafx.graphics javafx.base java.desktop java.xml jdk.jsobject ...... ...... ......
  • 16. Tool Support IDE IntelliJ IDEA Eclipse NetBeans Only Nightly Build
  • 17. Tool Support IDE IntelliJ IDEA Eclipse NetBeans Only Nightly Build Build Tool Maven Gradle Need to Write Options in Build File
  • 18. jdeps Tool to Check Dependency
  • 19. jdeps Tool to Check Dependency C:samplemods>jdeps -s jigsawsample.jar jigsawsample.jar -> java.base jigsawsample.jar -> java.logging jigsawsample.jar -> java.xml jigsawsample.jar -> javafx.base jigsawsample.jar -> javafx.controls jigsawsample.jar -> javafx.graphics jigsawsample.jar -> javafx.media
  • 20. jdeps Tool to Check Dependency C:samplemods>jdeps --generate-module-info . jigsawsample.jar writing to .jigsawsamplemodule-info.java module jigsawsample { requires java.logging; requires javafx.base; requires javafx.controls; requires javafx.media; requires transitive java.xml; requires transitive javafx.graphics; exports net.javainthebox.sample; exports net.javainthebox.sample.internal; }
  • 21. jdeps Tool to Check Dependency C:samplemods>jdeps --generate-module-info . jigsawsample.jar writing to .jigsawsamplemodule-info.java module jigsawsample { requires java.logging; requires javafx.base; requires javafx.controls; requires javafx.media; requires transitive java.xml; requires transitive javafx.graphics; exports net.javainthebox.sample; exports net.javainthebox.sample.internal; } Edit as Necessary
  • 23. import com.sun.javafx.tk.FontMetrics; import com.sun.javafx.tk.Toolkit; import javafx.scene.text.Font; public class FontSample { public static void main(String... args) { Font font = Font.font(24); Toolkit toolkit = Toolkit.getToolkit(); FontMetrics metrics = toolkit.getFontLoader().getFontMetrics(font); System.out.println(metrics.getLineHeight()); } }
  • 24. C:fxsample>javac FontSample.java FontSample.java:1: error: package com.sun.javafx.tk is not visible import com.sun.javafx.tk.FontMetrics; ^ (package com.sun.javafx.tk is declared in module javafx. graphics, which does not export it to the unnamed module) FontSample.java:2: error: package com.sun.javafx.tk is not visible import com.sun.javafx.tk.Toolkit; ^ (package com.sun.javafx.tk is declared in module javafx. graphics, which does not export it to the unnamed module) 2 errors
  • 25. import com.sun.javafx.tk.FontMetrics; import com.sun.javafx.tk.Toolkit; import javafx.scene.text.Font; public class FontSample { public static void main(String... args) { Font font = Font.font(24); Toolkit toolkit = Toolkit.getToolkit(); FontMetrics metrics = toolkit.getFontLoader().getFontMetrics(font); System.out.println(metrics.getLineHeight()); } }
  • 26. Non-Disclosure API Non Exported Packages com.sun... sun... java.awt.peer
  • 27. Non-Disclosure API Non Exported Packages com.sun... sun... java.awt.peer Exceptional API sun.misc.Unsafe sun.reflect.Reflection (Remove in Future)
  • 28. Solution add export by --add-exports option --add-exports module/package=target javac java
  • 29. Solution add export by --add-exports option --add-exports module/package=target javac java when non-modular system target is ALL-UNNAMED ex. javac --add-exports javafx.graphics/com.sun.javafx.tk=ALL-UNNAMED FontSample.java
  • 30. public class FontSample { public static void main(String... args) throws Exception { Font font = Font.font(24); FontMetrics metrics = Toolkit.getToolkit().getFontLoader().getFontMetrics(font); Class<FontMetrics> metricsClass = FontMetrics.class; Field lineHeight = metricsClass.getDeclaredField("lineHeight"); lineHeight.setAccessible(true); System.out.println(lineHeight.getFloat(metrics)); } }
  • 31. C:fxsample>javac --add-exports javafx.graphics/com.sun.javafx.tk=ALL-UNNAMED FontSample.java C:fxsample>java --add-exports javafx.graphics/com.sun.javafx.tk=ALL-UNNAMED FontSample WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by FontSample (file:/C:/fxsa mple/) to field com.sun.javafx.tk.FontMetrics.lineHeight WARNING: Please consider reporting this to the maintainers of FontSample WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a futu re release 31.921875
  • 32. public class FontSample { public static void main(String... args) throws Exception { Font font = Font.font(24); FontMetrics metrics = Toolkit.getToolkit().getFontLoader().getFontMetrics(font); Class<FontMetrics> metricsClass = FontMetrics.class; Field lineHeight = metricsClass.getDeclaredField("lineHeight"); lineHeight.setAccessible(true); System.out.println(lineHeight.getFloat(metrics)); } }
  • 34. Non-Disclosure API Reflection Reflective access to public --add-exports Reflective access to non-public --add-opens in execution using setAccessible(true) ex. java --add-opens javafx.graphics/com.sun.javafx.tk=ALL-UNNAMED FontSample.java
  • 35. import java.io.File; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Unmarshaller; import net.javainthebox.xml.Name; public class JAXBSample { public static void main(String... args) throws JAXBException { JAXBContext context = JAXBContext.newInstance("net.javainthebox.xml"); Unmarshaller unmarshaller = context.createUnmarshaller(); File file = new File("sakuraba.xml"); Name sakuraba = (Name)unmarshaller.unmarshal(file); System.out.println(sakuraba.getFirst() + " " + sakuraba.getLast()); } }
  • 36. C:jaxbsample>javac JAXBSample.java netjavaintheboxxmlName.java:11: error: package javax.xml. bind.annotation is not visible import javax.xml.bind.annotation.XmlAccessType; ^ (package javax.xml.bind.annotation is declared in module java.xml.bind, which is not in the module graph) <<skip the rest>>
  • 37. import java.io.File; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Unmarshaller; import net.javainthebox.xml.Name; public class JAXBSample { public static void main(String... args) throws JAXBException { JAXBContext context = JAXBContext.newInstance("net.javainthebox.xml"); Unmarshaller unmarshaller = context.createUnmarshaller(); File file = new File("sakuraba.xml"); Name sakuraba = (Name)unmarshaller.unmarshal(file); System.out.println(sakuraba.getFirst() + " " + sakuraba.getLast()); } }
  • 38. Non-Standard Module Modules not included in standard modulepath
  • 39.
  • 40. Non-Standard Module Modules not included in standard modulepath JAXB JAX-WS CORBA java.xml.bind java.xml.ws java.corba These modules will be removed in future You should use the modules supplied by Java EE
  • 41. Non-Standard Module Modules not included in standard modulepath JAXB JAX-WS CORBA java.xml.bind java.xml.ws java.corba These modules will be removed in future You should use the modules supplied by Java EE Incubator jdk.incubator.httpclient
  • 42. Solution Add Modules by --add-modules option --add-modules module javac java ex) java --add-modules java.xml.bind JAXBSample
  • 44. In Java SE 8, Only classpath is Used
  • 45. In Java SE 8, Only classpath is Used Module and Non-Module are Used In Java SE 9, modulepath classpath
  • 46. In Java SE 8, Only classpath is Used Module and Non-Module are Used In Java SE 9, modulepath classpath specified in module-info.java Module CAN Access Only Modules
  • 48. foo.jar bar.jarmyapp.jar Module Non-Module Access Directly: Automatic Module Access Indirectly: Unnamed Module
  • 49. foo.jar bar.jarmyapp.jar Module Non-Module Access Directly: Automatic Module Access Indirectly: Unnamed Module Automatic Unnamed
  • 51. foo.jar bar.jarmyapp.jar Module Non-Module Automatic Unnamed modulepath classpath Automatic Module: Named Module Unnamed Module: No Name Modu MANIFEST.MF Automatic-Module-Name or JAR filename Automatic Module Name is Defined by
  • 52. foo.jar bar.jarmyapp.jar Module Non-Module Automatic Unnamed modulepath classpath module myapp { requires foo; } > java -cp bar.jar -p mod -m myapp/myapp.Main
  • 54. foo.jar bar.jarmyapp.jar java.xml.bind Module Non-Module Automatic Module Can’ Describe Dependency t > java -cp bar.jar -p mods --add-modules java.xml.bind -m myapp/myapp.Main
  • 55. foo.jar bar.jarmyapp.jar java.xml.bind Module Non-Module Automatic Module Can’ Describe Dependency t > java -cp bar.jar -p mods --add-modules java.xml.bind -m myapp/myapp.Main > java -cp bar.jar -p mods --add-modules ALL-MODULE-PATH -m myapp/myapp.Main If You Don’ t Know Dependencies
  • 56. Conclusion Non-Disclosure API Issues of Non-Modular Software Non-Standard Module May Remove These APIs/Modules in Future modulepath & classpath Issues of Modular Software May Use Only modulepath in Future??
  • 57. Moving to Module Issues & Solutions Project Jigsaw Java in the Box Yuichi Sakuraba