An open API service indexing awesome lists of open source software.

https://github.com/purejava/winsparkle-java

Java bindings for WinSparkle
https://github.com/purejava/winsparkle-java

appcast java software-update sparkle update windows

Last synced: 19 days ago
JSON representation

Java bindings for WinSparkle

Awesome Lists containing this project

README

          

# winsparkle-java
![winsparkle-java](winsparkle-java.svg)

[![License](https://img.shields.io/github/license/purejava/winsparkle-java.svg)](https://github.com/purejava/winsparkle-java/blob/master/LICENSE)
[![Maven Central](https://img.shields.io/maven-central/v/org.purejava/winsparkle-java.svg?label=Maven%20Central)](https://central.sonatype.com/search?q=winsparkle-java&smo=true&namespace=org.purejava)

Java bindings for WinSparkle in 100% pure Java

# Requires
Java 22

# Usage
The bindings come in two flavors:

## Dependency *including* WinSparkle.dll 0.9.1
```java

org.purejava
winsparkle-java
1.3.2

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

## Dependency *excluding* WinSparkle.dll 0.9.1
```java

org.purejava
winsparkle-java-without-dll
1.3.2

```
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](https://github.com/vslavik/winsparkle).

## 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()`:
```java
// 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:
```java
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:
```java
// 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 Ralph Plawetzki

The winsparkle-java logo is made from [Icon Fonts](http://www.onlinewebfonts.com/icon) and is licensed by CC BY 3.0