Code Monkey home page Code Monkey logo

winsparkle-java's Introduction

winsparkle-java

winsparkle-java

License Maven Central

Java bindings for WinSparkle in 100% pure Java

Requires

Java 19 (preview)

  • due to the use of the new Foreign Function & Memory API

Usage

The bindings come in two flavors:

Dependency including WinSparkle.dll 0.8.0

<dependency>
    <groupId>org.purejava</groupId>
    <artifactId>winsparkle-java</artifactId>
    <version>1.2.0</version>
</dependency>

WinSparkle.dll gets loaded by the bindings. You don't need to worry about that.

Dependency excluding WinSparkle.dll 0.8.0

<dependency>
    <groupId>org.purejava</groupId>
    <artifactId>winsparkle-java-without-dll</artifactId>
    <version>1.2.0</version>
</dependency>

You need to place WinSparkle.dll in the Java library path yourself and the bindings take care of loading the dll from there.

All of the API function names are the same as the original WinSparkle project.

Initialize WinSparkle

Your app must call win_sparkle_init() somewhere to initialize WinSparkle and perform the check. The best place to do it is as soon after startup as possible, but no sooner than the app's main window is shown. WinSparkle may show its UI soon after this call, so it’s important that the user can immediately associate its updates popup window with your app.

Before calling win_sparkle_init(), you must set the appcast URL with win_sparkle_set_appcast_url():

// Initialize WinSparkle as soon as the app itself is initialized, right
// before entering the event loop:
winsparkle_h.win_sparkle_set_appcast_url("https://winsparkle.org/example/appcast.xml");
winsparkle_h.win_sparkle_init();

Finally, you should shut WinSparkle down cleanly when the app exits:

winsparkle_h.win_sparkle_cleanup();

A note on callbacks

WinSparkle provides a lot of useful callbacks. Using them requires a shared session and to allocate the memory for a callback (aka setting the pointer to a function that is executed as the callback) in the shared session:

// Declare a variable for the session
private MemorySession session;

// Open the session on initializing WinSparkle
session = MemorySession.openShared();

// Pass the session to the static method of the callback when memory for the callback is allocated
win_sparkle_did_not_find_update_callback_t.allocate(yourCallback, session);

// Close the session when WinSparkle is shut down
session.close();

Copyright

Copyright (C) 2022-2024 Ralph Plawetzki

The winsparkle-java logo is made from Icon Fonts and is licensed by CC BY 3.0

winsparkle-java's People

Contributors

dependabot[bot] avatar purejava avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

winsparkle-java's Issues

JVM crash on executing win_sparkle_did_find_update callback

Please agree to the following

Summary

JVM crashes on executing callback

What software is involved?

  • Operating System: Windows 11
  • winsparkle-java: 1.0.0

Steps to Reproduce

  1. Define a callback class
public class CB implements win_sparkle_did_find_update_callback_t {
  @Override
  public void apply() {
  }
}
  1. Set apply() method as the callback function to be executed
winsparkle_h.win_sparkle_set_did_find_update_callback(MemoryAllocator.ALLOCATE_CALLBACK_FOR(new CB()));
  1. Trigger the callback function via WinSparkle

Expected Behavior

Callback function executes

Actual Behavior

JVM crashes

Reproducibility

Always

Relevant Log Output

See below

Anything else?

A bug report has been submitted upstream at https://bugreport.java.com/bugreport/crash.jsp

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.