Do not throw exception for missing system modules that are "required static"
See original GitHub issueUsing update4j 1.4.2, I just got this error message when downloading a jar file:
java.lang.IllegalStateException: System module ‘jdk.jfr’ is missing from JVM image, required by ‘javafx.base’
When looking at the module using jmod, we are seeing this:
jmod describe javafx.base.jmod
javafx.base
exports javafx.beans
exports javafx.beans.binding
exports javafx.beans.property
exports javafx.beans.property.adapter
exports javafx.beans.value
exports javafx.collections
exports javafx.collections.transformation
exports javafx.event
exports javafx.util
exports javafx.util.converter
requires java.base mandated
requires java.desktop
requires jdk.jfr static
qualified exports com.sun.javafx to javafx.controls javafx.fxml javafx.graphics javafx.swing
qualified exports com.sun.javafx.beans to javafx.controls javafx.fxml javafx.graphics
qualified exports com.sun.javafx.binding to javafx.controls javafx.graphics
qualified exports com.sun.javafx.collections to javafx.controls javafx.graphics javafx.media javafx.swing
qualified exports com.sun.javafx.event to javafx.controls javafx.graphics
qualified exports com.sun.javafx.logging to javafx.controls javafx.fxml javafx.graphics javafx.swing javafx.web
qualified exports com.sun.javafx.property to javafx.controls
qualified exports com.sun.javafx.reflect to javafx.fxml javafx.web
qualified exports com.sun.javafx.runtime to javafx.graphics
contains com.sun.javafx.logging.jfr
contains com.sun.javafx.property.adapter
The important line here is requires jdk.jfr static
. As we can see, it is a “static” requirement. According to this article, “requires static” is used for compile-only dependencies:
- At compile time, bar must be present or there will be an error. During compilation bar is readable by foo.
- At run time, bar might be absent and that will cause neither error nor warning. If it is present, it is readable by foo.
So, I think update4j should not throw an exception in cases like these.
Issue Analytics
- State:
- Created 4 years ago
- Comments:12 (6 by maintainers)
Top Results From Across the Web
c# - Exception is: InvalidOperationException - The current type ...
Exception is : InvalidOperationException - The current type, is an interface and cannot be constructed. Are you missing a type mapping? I have...
Read more >The type initializer for '' threw an exception - CodeProject
I faced the Same error that is "System.TypeInitializationException". This error is raised due to Static constructor . Actually in my case i am ......
Read more >Lombok not working with JDK 11 modules (Jigsaw) #1723
I'm using: Java 11 Lombok 1.18.4 (also tried 1.18.5 edge) Gradle 5.0 (also tried with 4.9) PS: I have requires static lombok in...
Read more >Exception Class (System) - Microsoft Learn
A system failure is a run-time error that cannot be handled programmatically in a meaningful way. For example, any method can throw an...
Read more >How to Handle the Incompatible Types Error in Java - Rollbar
This error implies that the Java compiler is unable to resolve a value assigned to a variable or returned by a method, because...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Well, yeah, all my coworkers already know about update4j because I did an in-depth presentation about how the updater works. Other than that, I don’t have contacts to any other Java developers :p
Thanks again. I can confirm that the fix works.