JDK8与JDK13关于rt.jar的区别
程序员文章站
2024-01-08 15:41:17
在JDK8中,rt.jar有64MB,tools.jar有17MB。 JDK中的lib\tools.jar和JRE中的lib\rt.jar已从Java SE 9中删除。这些JAR中可用的类和资源现在以文件中的内部格式存储在lib目录的命名模块中。 可以使用称为jrt的新方案来从运行时映像检索这些类和 ......
在jdk8中,rt.jar有64mb,tools.jar有17mb。
$ cd /library/java/javavirtualmachines/jdk1.8.0_231.jdk/contents/home $ ls copyright license readme.html bin include javafx-src.zip jre lib man release src.zip $ ls -lh ./jre/lib/rt.jar -rw-r--r-- 1 root wheel 64m 10 5 18:39 ./jre/lib/rt.jar $ ls -lh ./lib/tools.jar -rw-r--r-- 1 root wheel 17m 10 5 18:40 ./lib/tools.jar $ ls -lh lib/dt.jar -rw-r--r-- 1 root wheel 159k 10 5 18:40 lib/dt.jar
jdk中的lib\tools.jar和jre中的lib\rt.jar已从java se 9中删除。这些jar中可用的类和资源现在以文件中的内部格式存储在lib目录的命名模块中。 可以使用称为jrt的新方案来从运行时映像检索这些类和资源。 依靠这些jar位置的应用程序将不再工作。可参考:
- java platform, standard edition oracle jdk 9 migration guide一文中的"removed rt.jar and tools.jar"
- quora: why is rt.jar missing from jdk 9?
jdk 13的目录如下,可以看出在lib目录下有40个lib*.dylib文件,dylib是macos系统的动态库(windows为dll文件,linux为so文件)。
$ cd /library/java/javavirtualmachines/jdk-13.0.2.jdk/contents/home $ ls bin conf include jmods legal lib man release $ ls -lh lib 39k classlist 7.0m ct.sym 2.9k fontconfig.bfc 7.7k fontconfig.properties.src 128b jfr 104k jrt-fs.jar 14k jspawnhelper 29b jvm.cfg 15k libattach.dylib 466k libawt.dylib 663k libawt_lwawt.dylib 20k libdt_socket.dylib 9.3k libextnet.dylib 1.0m libfontmanager.dylib 512k libfreetype.dylib 39k libinstrument.dylib 39k libj2gss.dylib 14k libj2pcsc.dylib 68k libj2pkcs11.dylib 8.7k libjaas.dylib 142k libjava.dylib 143k libjavajpeg.dylib 8.6k libjawt.dylib 211k libjdwp.dylib 24k libjimage.dylib 60k libjli.dylib 9.5k libjsig.dylib 57k libjsound.dylib 282k liblcms.dylib 19k libmanagement.dylib 8.6k libmanagement_agent.dylib 22k libmanagement_ext.dylib 405k libmlib_image.dylib 75k libnet.dylib 53k libnio.dylib 20k libosx.dylib 104k libosxapp.dylib 27k libosxkrb5.dylib 39k libosxsecurity.dylib 35k libosxui.dylib 21k libprefs.dylib 8.3k librmi.dylib 45k libsaproc.dylib 288k libsplashscreen.dylib 142k libsunec.dylib 83k libunpack.dylib 45k libverify.dylib 26k libzip.dylib 133m modules 2.7k psfont.properties.ja 10k psfontj2d.properties 192b security 160b server 47m src.zip 105k tzdb.dat $ file libjava.dylib libjava.dylib: mach-o 64-bit dynamically linked shared library x86_64 $ otool -l libjava.dylib libjava.dylib: @rpath/libjava.dylib (compatibility version 1.0.0, current version 1.0.0) @rpath/libjvm.dylib (compatibility version 1.0.0, current version 1.0.0) @rpath/libverify.dylib (compatibility version 1.0.0, current version 1.0.0) /system/library/frameworks/corefoundation.framework/versions/a/corefoundation (compatibility version 150.0.0, current version 1560.12.0) /system/library/frameworks/foundation.framework/versions/c/foundation (compatibility version 300.0.0, current version 1560.12.0) /system/library/frameworks/systemconfiguration.framework/versions/a/systemconfiguration (compatibility version 1.0.0, current version 963.200.27) /usr/lib/libsystem.b.dylib (compatibility version 1.0.0, current version 1252.200.5) /usr/lib/libobjc.a.dylib (compatibility version 1.0.0, current version 228.0.0)