使用Kotlin 1.1.5 的REPL 来简单分析一下Java 9 中的$ jmod list java.base.jmod

$ jmod list java.base.jmod

命令行列出了 模块 java.base.jmod 中所有文件(.class文件, .dat, .jar, .cfg, .dylib 等 )共 5761个文件:

/Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home/jmods$ jmod list java.base.jmod|wc -l
    5761

我们来看下都有哪些包里面的类:

我们把 java.base.jmod中的所有文件list放到文件中:

val lines = File("/Users/jack/java/java.base.jmods.txt").readLines()
val set = HashSet<String>()
lines.forEach{ 
    set.add(it.substring(0,it.lastIndexOf("/")) ) 
}
>>> set.forEach{println(it)}

我们可以看到java.base.jmod中都有哪些核心API的包:


classes/java/util/stream
classes/jdk/internal/vm/annotation
classes/jdk/internal/org/objectweb/asm/tree/analysis
bin
classes/java/security/cert
classes/sun/nio
conf
classes/sun/net/sdp
classes/META-INF/services
classes/sun/reflect/generics/repository
classes/java/text
classes/sun/reflect/generics/parser
classes/sun/text/spi
classes/sun/usagetracker
lib/jli
classes/sun/net/www/protocol/http
classes/javax/crypto/interfaces
classes/jdk/internal
classes/jdk/internal/loader
classes/sun/net/dns
classes/javax/security/auth
classes/sun/security/provider
classes/java/time/format
classes/sun/security/internal/interfaces
classes/sun/security/provider/certpath/ssl
classes/sun/launcher
classes/jdk/internal/vm/cds/resources
classes/sun/security/internal/spec
classes/sun/net/ext
classes/sun/util/resources
classes/java/lang
classes/sun/net/www/content/text
classes/sun/security/tools
classes/jdk/internal/reflect
classes/java/util/function
classes/sun/security/util
classes/java/util/spi
classes/sun/reflect/generics/tree
classes/jdk/internal/misc
classes/jdk/internal/perf
classes/sun/util/cldr
classes/jdk/internal/org/objectweb/asm/commons
classes/jdk/internal/org/xml/sax
classes/jdk/internal/util/xml/impl
classes/sun/invoke/util
classes/sun/util/resources/cldr
classes/sun/reflect/generics/factory
classes/com/sun/net/ssl/internal/www/protocol/https
classes/jdk/internal/org/objectweb/asm/tree
classes/java/net
classes/sun/security/rsa
classes/sun/launcher/resources
classes/sun/net/www
classes/java/util/concurrent/atomic
classes/java/nio/channels
classes/sun/nio/fs
conf/security/policy
classes/sun/reflect/generics/reflectiveObjects
classes/sun/util/calendar
classes/java/security/acl
classes/javax/net/ssl
classes/jdk/internal/util
classes/sun/text/resources
classes/jdk/internal/math
include
classes/java/util
classes/java/lang/reflect
classes/sun/reflect/misc
classes/java/io
include/darwin
classes/sun/reflect/annotation
classes/java/math
classes/java/nio/channels/spi
classes/sun/net/ftp
classes/java/lang/annotation
classes/sun/util/locale/provider
classes/java/time/temporal
classes/sun/text/bidi
classes/sun/util/spi
classes/sun/security/jca
lib/security
classes/java/security/spec
classes/sun/net/www/http
classes/jdk/internal/org/objectweb/asm
classes/sun/net/www/protocol/jar
classes/sun/net/util
classes/sun/text/normalizer
classes/java/net/spi
classes/apple/security
classes/java/lang/module
classes/jdk/internal/ref
classes/sun/text/resources/cldr
classes/jdk/internal/org/objectweb/asm/signature
classes/sun/security/pkcs
classes/jdk/internal/module
classes/jdk/internal/vm
lib
classes/sun/net/ftp/impl
lib/server
classes/sun/net/www/protocol/jrt
classes/sun/net/www/protocol/https
classes/java/lang/invoke
classes/jdk/internal/jrtfs
classes/java/time/zone
classes/sun/text
classes/sun/net
classes/java/nio/charset/spi
conf/security
legal
classes/java/security/interfaces
classes/sun/security/provider/certpath
classes/javax/security/cert
conf/security/policy/limited
classes/java/util/regex
classes/sun/net/spi
classes/java/nio/charset
classes/java/nio/file/attribute
classes/java/util/concurrent
classes/javax/security/auth/x500
classes/java/lang/ref
classes/sun/net/smtp
classes/jdk/internal/jmod
classes/javax/crypto
classes/com/sun/java/util/jar/pack
classes/java/time
classes/jdk/internal/jimage
classes/sun/net/www/protocol/http/ntlm
classes/sun/security/ssl
classes/sun/security/x509
classes/sun/util/logging
classes/sun/net/idn
classes/sun/net/www/protocol/ftp
classes/java/util/zip
classes/sun/reflect/generics/visitor
classes
classes/java/nio
classes/com/sun/net/ssl
classes/java/util/jar
classes/javax/security/auth/spi
classes/sun/net/www/protocol/jmod
classes/sun/security/pkcs12
classes/java/text/spi
classes/sun/security/pkcs10
classes/sun/security/timestamp
classes/javax/net
classes/javax/security/auth/callback
classes/java/nio/file/spi
classes/javax/crypto/spec
classes/com/sun/net/ssl/internal/ssl
classes/com/sun/crypto/provider
classes/jdk/internal/logger
classes/sun/util/locale
classes/java/nio/file
classes/jdk/internal/jimage/decompressor
classes/sun/invoke
classes/sun/security/validator
classes/com/sun/security/cert/internal/x509
classes/jdk/internal/org/objectweb/asm/util
classes/sun/reflect/generics/scope
classes/sun/invoke/empty
classes/sun/net/www/protocol/mailto
classes/com/sun/security/ntlm
classes/jdk/internal/util/xml
classes/sun/nio/ch
classes/jdk/internal/util/jar
classes/jdk/internal/org/xml/sax/helpers
classes/sun/net/www/protocol/file
classes/java/time/chrono
classes/javax/security/auth/login
classes/sun/nio/cs
classes/sun/util
conf/security/policy/unlimited
classes/sun/security/tools/keytool
classes/sun/security/action
classes/java/security
classes/java/util/concurrent/locks

KotlinChina编程社区 微博

《Kotlin极简教程》正式上架:

点击这里 > 去京东商城购买阅读

点击这里 > 去天猫商城购买阅读

非常感谢 if (boy) { 帅气英俊潇洒} else { 魔鬼身材天使脸蛋美丽动人女神气质} 的您。大家请多支持!!!您的支持,是我源源不断的写作的动力! 如果您有任何问题,欢迎随时与我交流~

    原文作者:一个会写诗的程序员
    原文地址: https://www.jianshu.com/p/d51a5119e8f5
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞