<div dir="ltr"><div>Hi there,</div><div>this is Jörg, the one who met Stuart Marks at Devoxx BE 2025.</div><div><br></div><div>We talked at Devoxx Antwerp about a flaw with the programmatic accessibility of jimage in JDK21.</div><div><br></div><div>While it was with source/target 8 possible to compile and access the Main of jlink/jimage/jmod, encapsulation with source/target 11 it is not. But the intended new ToolProvider API which should make the three accessible in a controlled way, lacks the Tool Registration of jimage.<br><br>Registration for jmod can be seen here: <a href="https://github.com/openjdk/jdk/blob/master/src/jdk.jlink/share/classes/jdk/tools/jmod/Main.java#L53">https://github.com/openjdk/jdk/blob/master/src/jdk.jlink/share/classes/jdk/tools/jmod/Main.java#L53</a>, same for jlink. But jimage seems to be forgotten: <a href="https://github.com/openjdk/jdk/blob/master/src/jdk.jlink/share/classes/jdk/tools/jimage/Main.java">https://github.com/openjdk/jdk/blob/master/src/jdk.jlink/share/classes/jdk/tools/jimage/Main.java</a>.<br><br>IMHO it is trivial to add registration for the jimage in code and module definition and it seems that it also could be almost riskless to be backported to JDK25/17/11.<br><br>This would make me as the "nobody use that" user happy, because it feels so bad to access this via ProcessBuilder and external process call.</div><div><br>Withdrawn ticket in OpenJDK is here: <a href="https://bugs.openjdk.org/browse/JDK-8359429">https://bugs.openjdk.org/browse/JDK-8359429</a>. <br>I already cloned the OpenJdk Github repo to provide a pull request to provide the fix, but it seems I am not familiar enough with the contribution process and so on.</div><div><br></div><div>As Stuart mentioned the question in the JDK-8359429 issue comment, I tried the Chuck Norris --add-opens and also accessing JImageTask instead of its Main class, but with no success.</div><div><br></div><div>And here is a hint for the question in the issue comment for Alan Bateman.</div><div>I have a somewhat unusual deployment process and have several checks in place to ensure that there are all classes for the deployment target on board and are deployed for a certain installation.</div><div>The check scans among other things all META-INF/services if service interface and service implementations are part of the deployed classes in jars and modules. To do that, the jimage list command with the module file of the with the app deployed target JRE is used to gather the list of the JRE classes.</div><div><br></div><div>Thanks a lot.</div><div>Regards.</div><div>Jörg Michelberger</div><div><br></div></div>