简体   繁体   中英

How to reduce jre size for bundling with an application ?

I want to reduce size of jre. Already I have exclude some files from jre which are given bellow.

bin\java.exe
bin\javaw.exe
bin\javaws.exe
bin\javacpl.exe
bin\jucheck.exe
bin\dtplugin
bin\jabswitch.exe
bin\java_crw_demo.dll
bin\JavaAccessBridge-32.dll
bin\JavaAccessBridge.dll
bin\JAWTAccessBridge-32.dll
bin\JAWTAccessBridge.dll
bin\WindowsAccessBridge-32.dll
bin\WindowsAccessBridge.dll
bin\wsdetect.dll
bin\dtplugin\*
bin\plugin2\*
bin\deploy.dll
bin\jfr.dll
bin\javacpl.cpl
lib\deploy.jar
lib\plugin.jar
lib\deploy\*
lib/jfxswt.jar
bin\decora-sse.dll
bin\fxplugins.dll
bin\glass.dll
bin\glib-lite.dll
bin\gstreamer-lite.dll
bin\javafx-font.dll
bin\javafx_font_t2k.dll
bin\javafx-iio.dll
bin\jfxmedia.dll
bin\jfxwebkit.dll
bin\prism_common.dll
bin\prism-d3d.dll
bin\prism_es2.dll
bin\prism_sw.dll

After excluding this files it's size is 107 mb. But I need to make jre size within 60 mb or 70 mb for my application, Main part of my application are also given bellow.

import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.servlet.ServletHandler;

public static void main(String[] args) {

    try {
        //LOGGER.info("Application started");
        Server server = new Server(8680);

        //LOGGER.info("Application started1");
        ServletHandler servletHandler = new ServletHandler();
        server.setHandler(servletHandler);

        //LOGGER.info("Application started2");
        servletHandler.addServletWithMapping(HelloServlet.class, "/");

        server.start();
        server.join();
    } catch (Exception ex) {

        LOGGER.info(" " + ex.getLocalizedMessage());
    }

}

Default jre size is 170 mb. But I need just 60 mb or 70 mb size of jre for this application. Now what can I do to make size of jre is 60 mb or 70 mb.

如果您没有使用 Javafx,那么删除“bin\\jfxwebkit.dll”文件会有所帮助,因为它超过 50 MB。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM