• <small id='oeYOX'></small><noframes id='oeYOX'>

    • <bdo id='oeYOX'></bdo><ul id='oeYOX'></ul>
    <tfoot id='oeYOX'></tfoot>
  • <legend id='oeYOX'><style id='oeYOX'><dir id='oeYOX'><q id='oeYOX'></q></dir></style></legend>
    <i id='oeYOX'><tr id='oeYOX'><dt id='oeYOX'><q id='oeYOX'><span id='oeYOX'><b id='oeYOX'><form id='oeYOX'><ins id='oeYOX'></ins><ul id='oeYOX'></ul><sub id='oeYOX'></sub></form><legend id='oeYOX'></legend><bdo id='oeYOX'><pre id='oeYOX'><center id='oeYOX'></center></pre></bdo></b><th id='oeYOX'></th></span></q></dt></tr></i><div id='oeYOX'><tfoot id='oeYOX'></tfoot><dl id='oeYOX'><fieldset id='oeYOX'></fieldset></dl></div>

      1. 通过将自己的应用程序类添加到 classes.jsa 来加速应用程序启动

        时间:2023-08-24
      2. <legend id='5hvTE'><style id='5hvTE'><dir id='5hvTE'><q id='5hvTE'></q></dir></style></legend>
        <tfoot id='5hvTE'></tfoot>

            1. <small id='5hvTE'></small><noframes id='5hvTE'>

                  <tbody id='5hvTE'></tbody>
                <i id='5hvTE'><tr id='5hvTE'><dt id='5hvTE'><q id='5hvTE'><span id='5hvTE'><b id='5hvTE'><form id='5hvTE'><ins id='5hvTE'></ins><ul id='5hvTE'></ul><sub id='5hvTE'></sub></form><legend id='5hvTE'></legend><bdo id='5hvTE'><pre id='5hvTE'><center id='5hvTE'></center></pre></bdo></b><th id='5hvTE'></th></span></q></dt></tr></i><div id='5hvTE'><tfoot id='5hvTE'></tfoot><dl id='5hvTE'><fieldset id='5hvTE'></fieldset></dl></div>
                  <bdo id='5hvTE'></bdo><ul id='5hvTE'></ul>
                  本文介绍了通过将自己的应用程序类添加到 classes.jsa 来加速应用程序启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  为了加快 JVM 的启动时间,Sun 开发人员认为最好在安装 JVM 期间为平台预编译标准运行时类.可以找到这些预编译的类,例如在:

                  To speed up the startup time of the JVM, the Sun developers decided it is a good idea to precompile the standard runtime classes for a platform during installation of the JVM. These precompiled classes can be found e.g. at:

                  $JAVA_HOMEjreinclientclasses.jsa

                  $JAVA_HOMEjreinclientclasses.jsa

                  我的公司目前正在开发一个带有自己的 JRE 的 Java 独立应用程序,因此通过将我们自己的应用程序类也添加到此 jsa 文件中来加快我们的应用程序启动时间将是一个绝佳的选择.

                  My company currently develops a Java standalone application which brings its own JRE, so it would be a fantastic option to speed up our application start time by adding our own application classes to this jsa file, too.

                  我不相信 JSA 文件是魔术创建的,所以:它是如何创建的?以及如何欺骗 JVM 合并我自己的类?

                  I don't believe the JSA file was created by magic, so: How is it created? And how can I trick the JVM into incorporating my own classes?

                  编辑:我已经发现了以下内容:

                  EDIT: I already found out the following:

                  classes.jsa 由命令创建

                  The classes.jsa is created by the command

                  java -Xshare:dump
                  

                  可以在 $JAVA_HOME/jre/lib/classlist 中找到要合并到转储中的类列表.

                  The list of classes to incorporate in the dump can be found in $JAVA_HOME/jre/lib/classlist.

                  我什至设法在这里添加了我自己的类(并将它们添加到 rt.jar 中以便 java 找到它们),并在类列表文件下生成我自己的校验和.

                  I even managed to add my own classes here (and to add them into the rt.jar for java to find them), and to generate my own checksum below the classlist file.

                  最后一个问题是:似乎只有包 java、com.sun 和 org.w3c 中的类被识别,如果我将相同的类留在原来的包中,它们将不会被加载.我在整个 OpenJDK 源代码中搜索了关于此的指针,但它似乎与保护域有关.如果有人对此主题足够感兴趣并且知识渊博,请添加一些指针供我进一步调查.

                  The final problem is: Only classes in the packages java, com.sun, and org.w3c seem to be recognized, if I leave the same classes in their original packages, they won't be loaded. I searched the whole OpenJDK source for pointer about this, but it seems to have something to do with protection domains. If someone is interested enough in this topic and knowledgeable enough, please add some pointers for me to investigaete further.

                  推荐答案

                  从 Java 8u40(和 Embedded Java 8u51)开始,Java 现在支持应用程序类数据共享 (AppCDS)(即共享存档中您自己的类).在我们的嵌入式 Java 上,我们发现启动改进超过 40%!非常棒,因为我们几乎没有任何工作......

                  As of Java 8u40 (and Embedded Java 8u51), Java now supports Application Class Data Sharing (AppCDS) (ie your own classes in the shared archive). On our embedded java, we've found a startup improvement of >40%! Pretty awesome for almost no work on our part...

                  https://blogs.oracle.com/thejavatutorials/entry/jdk_8u40_released

                  这篇关于通过将自己的应用程序类添加到 classes.jsa 来加速应用程序启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:JRockit JVM 与 HotSpot JVM 下一篇:Java 无法为对象堆错误保留足够的空间

                  相关文章

                  • <bdo id='30wC4'></bdo><ul id='30wC4'></ul>
                    1. <tfoot id='30wC4'></tfoot>

                      <small id='30wC4'></small><noframes id='30wC4'>

                    2. <legend id='30wC4'><style id='30wC4'><dir id='30wC4'><q id='30wC4'></q></dir></style></legend>

                    3. <i id='30wC4'><tr id='30wC4'><dt id='30wC4'><q id='30wC4'><span id='30wC4'><b id='30wC4'><form id='30wC4'><ins id='30wC4'></ins><ul id='30wC4'></ul><sub id='30wC4'></sub></form><legend id='30wC4'></legend><bdo id='30wC4'><pre id='30wC4'><center id='30wC4'></center></pre></bdo></b><th id='30wC4'></th></span></q></dt></tr></i><div id='30wC4'><tfoot id='30wC4'></tfoot><dl id='30wC4'><fieldset id='30wC4'></fieldset></dl></div>