<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">But you’re requiring your users to download the JDK, which is ~300MB.<br></blockquote><div><br></div><div>Specifically, where we are (mainland China), home broadband is very cheap, but commercial broadband is more expensive.</div><div>The cost of commercial uplink bandwidth can exceed five hundred times that of home downlink bandwidth.</div><div>For us, getting users to download more content is irrelevant, but the cost to the distributor of the content is painful.<br></div><div><br></div><div>Also, it is not true that users need to download the complete JDK.<br></div><div>"JRE is deprecated" is just a technical talk.<br></div><div>In reality, JDK vendors usually provide a small JDK image called "JRE", which is sufficient for users.<br></div><div>You can't prevent users from downloading these small images provided by the vendor just because "JRE is deprecated".<br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">In any event, if your placing the responsibility of choosing an appropriate runtime on your users, then surely your users need to know that a particular version of the application may not run on all versions of the runtime. If they’re required to assemble your application together, they are the just the right target for the warning.<br></blockquote><div><br></div><div>If the operating environment cannot satisfy our program, we will actively report to the user and exit.</div><div>We don't need these false warnings to drown out our real warnings,<br></div><div><br></div><div>Additionally, even if JNI/Panama is not available, our programs can safely fall back to other implementations.<br></div><div>The only way our program can crash because of FFI is if you crash it on purpose.<br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">jlink supports all platforms for which there’s a supported runtime. Again, someone has to obtain a runtime and assemble the application, either you or your users (and it’s a smaller distribution if it comes from you). If you want your users to find and supply the runtime, they need to be aware of any compatibility issue between the runtime they need to obtain and your application.<br></blockquote><div> </div><div>We should be the ones with the knowledge, so why should control of these warnings be in the hands of users who may know nothing about it?<br></div><div>They just need to download the JRE from the place specified in our documentation or install it through the package manager.<br></div><div>We have almost a million users, most of whom don't know Java, but few complain about it.<br></div><div><br></div><div><br></div><div><div>As for the other things you said, I won’t reply to them one by one.<br></div><div>You seem to want users to feel that treating Java as an internal part of the program is the only way to use it?<br></div><div>Isn't Java more often seen as a dependency, as a platform?</div><div>For Windows users, they just need to download the MSI installer for JDK or JRE (in a broad sense), install it, and double-click to run the program.</div></div><div>For Linux users, they only need to enter `apt install default-java` or `pacman -S jdk-openjdk`, as they often do, and then run the program.<br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">You asked and we delivered. That official replacement is jlink. In the future it may be enhanced by something similar to Hermetic Java.<br></blockquote><div><br></div><div>The shadow jar is based on Java as a platform, jlink is not a direct replacement.</div><div><br></div><div>The frequency with which the program itself is updated does not often match the frequency with which Java is updated, either for the server or the user.</div><div><br></div><div>For servers, we tend to think of Java as part of the environment. They often require special processes to be updated and do not need to be updated every time the program is updated.</div><div>They can be part of the base image.</div><div>In this case, deploying shadow jars is far more convenient and faster than using jlink and requires less transmission.</div><div>This is a usage scenario I often see.<br></div><div><br></div><div>As a user, I have many small tools developed in Java. None of them require a fixed Java version, only a minimum Java version.</div><div>I'd much rather install just one JDK than have dozens of jlink-generated images containing JVMs.<br></div><div><br></div><div>So, I agree with the point of jlink, but I still think another replacement for the shadow jar is necessary.</div><div><br></div><div>Glavo</div><div><br></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Sep 6, 2023 at 8:51 PM Ron Pressler <<a href="mailto:ron.pressler@oracle.com">ron.pressler@oracle.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
<br>
> On 6 Sep 2023, at 13:16, Glavo <<a href="mailto:zjx001202@gmail.com" target="_blank">zjx001202@gmail.com</a>> wrote:<br>
> <br>
> Why? You can now easily pick whichever runtime you want (a minimal one is only 40MB!) and not require the end user to install Java or even know that your application is written in Java. Also, the proposed change would have no impact on anyone using a client JRE (8 is the *highest* version for which a JRE is available).<br>
> <br>
> At least for us, 40M is very large. <br>
> <br>
> We have an application, and we carefully ensure that the application size is within 5MB.<br>
> An increase in program size means a multifold increase in server network expenditures.<br>
> Not all parts of the world have the same cheap internet access, nor are free CDNs available everywhere.<br>
<br>
But you’re requiring your users to download the JDK, which is ~300MB.<br>
<br>
In any event, if your placing the responsibility of choosing an appropriate runtime on your users, then surely your users need to know that a particular version of the application may not run on all versions of the runtime. If they’re required to assemble your application together, they are the just the right target for the warning.<br>
<br>
> <br>
> Also, jimage is not suitable for all scenarios.<br>
> We provide support for Windows (x86, x86-64, ARM64), Linux (x86, x86-64, ARM32, ARM64, MIPS64EL, LoongArch64, RISC-V 64), macOS (x86-64, ARM64) equally.<br>
> We only need to distribute a jar file of less than 5MB to work on these platforms.<br>
> jlink? Do you mean we have to distribute a dozen huge programs at a time?<br>
> <br>
<br>
jlink supports all platforms for which there’s a supported runtime. Again, someone has to obtain a runtime and assemble the application, either you or your users (and it’s a smaller distribution if it comes from you). If you want your users to find and supply the runtime, they need to be aware of any compatibility issue between the runtime they need to obtain and your application.<br>
<br>
<br>
> But we are looking forward to a better alternative than shadow jar.<br>
> I think it is an unfortunate fact that the module path and classpath must be specified, and many people want to get rid of it,<br>
> which is why the shadow jar plugin is so popular. <br>
> So I don't think "the Java program already needs a lot of options" is a reason to keep adding more options that have to be used.<br>
> Why can't we integrate this information inside the program?<br>
<br>
You can have all these things, and we’ve worked very hard to provide them to you. The solution is called jlink, but if choose not to use it, you’ll still have all those problems.<br>
<br>
Now, a shadow JAR isn’t anywhere close to one file anymore because the JRE is gone. It’s one 5MB file plus 300MB of many JDK files (aimed at developers, not users) that your users must download and manage.<br>
<br>
> When we have to use startup scripts, we sacrifice some cross-platform capabilities, and make it harder for users to configure the JVM in a standard way.<br>
> They have to use the one provided by the script, or the JAVA_TOOL_OPTIONS environment variable.<br>
> Before that, they need to distinguish between "necessary options for the program" and "unnecessary tuning options" provided by default by scripts mixed together,<br>
> carefully avoid their options conflicting with the default options.<br>
<br>
If you’re talking about users who may want to configure JVM options, then these are very sophisticated users, because that’s a very sophisticated configuration.<br>
<br>
> In addition, since the startup script and the program bytecode are not bundled in the same file, users may mistakenly update only part of the program, <br>
> resulting in a mismatch between the startup script and the program, causing the program to crash during runtime.<br>
<br>
Again, you’re talking about users who are really developers (or at least sophisticated operations users). Nevertheless, you may search the mailing lists for recent discussions about “Hermetic Java”. The application will still be as large as a jlinked-one (though not nearly as large as what you have now, which requires the JDK), all in one file. <br>
<br>
> <br>
> jlink and jpackage are suitable for some scenarios, but they are not suitable for many scenarios.<br>
<br>
Perhaps, but they are, however suitable for the scenarios you’ve described.<br>
<br>
> Many times, a single file that does not require complex configuration, is not bundled with JRE, and can be directly cross-platform is more popular.<br>
> We are looking forward to an official replacement for the shadow jar so that we can use JPMS more.<br>
<br>
You asked and we delivered. That official replacement is jlink. In the future it may be enhanced by something similar to Hermetic Java.<br>
<br>
— Ron<br>
<br>
<br>
</blockquote></div>