create a JAVA Standalone executable application to run on different platforms without any Installation

后端 未结 4 1504
北恋
北恋 2021-02-14 19:24

I have created a run time image for my Java application using jlink and I would like to be able to ship my app as an executable to different platforms.

Ideally, it woul

4条回答
  •  日久生厌
    2021-02-14 19:57

    Double click to run executables on multiple platforms, requires prior registration of the file type with the operating system, or an existing file type to know how to handle the code.

    jlink statically links the "required modules and their transitive dependencies" to the output.

    There is no cross platform solution to this problem.

    It is improbable(or to put it another way, not feasible) to include all platforms in a single file, since each executable type(COFF, ELF...), has a different structure. You could attempt to use a generic batch file to start the proper executable, but on Windows, that would require a text file type encoding; thus poisoning the remaining binary code.

    Using jlink and the new jmod file format will allow you store native code in a Java container, and thus allowing the entry point into the embedded native JRE code in a single executable image for a single pre-defined platform.

    The other side of this issue is the security implications. Since the embedded JRE is not subject to security updates, crackers may choose to embed a previously known flawed JRE, thus exposing corrected exploits to unknowing consumers.

    The expected response from Anti-Virus programs would be to flag all non-updated embedded JRE's as viruses.

提交回复
热议问题