其他分享
首页 > 其他分享> > JDK8与JDK13关于rt.jar的区别

JDK8与JDK13关于rt.jar的区别

作者:互联网

在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位置的应用程序将不再工作。可参考:

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)

标签:rt,1.0,lib,JDK13,jar,current,version,dylib
来源: https://www.cnblogs.com/sxpujs/p/12450338.html