update4j / update4j

Create your own auto-update framework
Apache License 2.0
794 stars 72 forks source link

Do not throw exception for missing system modules that are "required static" #70

Closed ChristianCiach closed 5 years ago

ChristianCiach commented 5 years ago

Using 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.

mordechaim commented 5 years ago

Ok, you now deserve being featured under the 'Attribution' section of the README...

So after this is fixed do you recommend releasing 1.4.3 or wait for something bigger?

ChristianCiach commented 5 years ago

So after this is fixed do you recommend releasing 1.4.3 or wait for something bigger?

I would like to see a 1.4.3 soon after this is fixed, just so that I can remove my current workaround :) As they say: release early, release often. (I don't know if this fits here, but I wanted to say something clever).

mordechaim commented 5 years ago

Ok I have your back. I used to feel like I use up space on Maven's servers but I shouldn't care much anyway.

ChristianCiach commented 5 years ago

That is very considerate of you, and I am the same kind of person. But update4j is auch a tiny library compared to almost anything else, that I agree that you shouldn't care much :)

Have a nice weekend!

mordechaim commented 5 years ago

update4j-1.4.3-SNAPSHOT.zip

Give it a try and report back. Will release tomorrow.

ChristianCiach commented 5 years ago

Just by reviewing the code I am sure that the fix is correct. I feel a bit sick, so I probably won't try out the snapshot today or tomorrow.

Thanks for the attribution! It makes me wonder how many people actually use update4j in production. I would have expected for update4j to become very popular, now that Webstart is dead and the alternative libraries are quite lacking.

mordechaim commented 5 years ago

Capture

Metrics are not super high, but I see about 150-200 unique visitors bi-weekly. I'm lacking the proper digital marketing strategies to push this forward. I know at-least one publicly available application that uses it—MuseIDE.

ChristianCiach commented 5 years ago

Interesting! Our application is not publicly available. We are using update4j to update the rich-client of our Virtual Power Plant until we've finished the migration to a web application.

ChristianCiach commented 5 years ago

Thanks again. I can confirm that the fix works.

mordechaim commented 5 years ago

Thanks for reporting back!

mordechaim commented 5 years ago

@ChristianCiach Can you please refer this project to your friends/co-workers? I'd like to see this get more popular.

ChristianCiach commented 5 years ago

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