The shipped VncThumbnailViewerWin1.4.2.exe is a native launcher stub with a Java JAR appended. This commit adds: - src/: full Java source recovered from the bundled .class files (CFR), plus src/summary.txt with decompiler caveats - ANALYSIS.md: architecture, data flow, hosts-file format, and security notes - build-app-image.ps1: reproducible jpackage build that repackages the original classes and bundles a slim jlinked runtime (java.base + java.desktop) into a self-contained native app-image (no Java required on the target) The 74 MB app-image is shipped as a release asset rather than tracked. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
39 lines
1.8 KiB
PowerShell
39 lines
1.8 KiB
PowerShell
# Builds a self-contained native app-image (bundled JRE, no Java required on target).
|
|
# Requires a JDK 17+ on PATH (needs jar, jdeps, jpackage). Tested with Temurin 21.
|
|
# Reuses the ORIGINAL compiled .class files from the shipped exe (identical behavior).
|
|
#
|
|
# Usage: powershell -ExecutionPolicy Bypass -File build-app-image.ps1
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
$root = $PSScriptRoot
|
|
$work = Join-Path $root "build-tmp"
|
|
$classes = Join-Path $work "classes"
|
|
$dist = Join-Path $root "dist"
|
|
|
|
Remove-Item $work, $dist -Recurse -Force -ErrorAction SilentlyContinue
|
|
New-Item -ItemType Directory -Force $classes | Out-Null
|
|
|
|
# 1. Extract the class files (the .exe is a launcher stub + a ZIP/JAR).
|
|
Copy-Item (Join-Path $root "VncThumbnailViewerWin1.4.2.exe") (Join-Path $work "app.zip")
|
|
Expand-Archive -Path (Join-Path $work "app.zip") -DestinationPath $classes -Force
|
|
|
|
# 2. Repackage into a runnable JAR, preserving the original manifest (Main-Class).
|
|
$jar = Join-Path $work "VncThumbnailViewer.jar"
|
|
$jarInput = Join-Path $work "jarinput"
|
|
New-Item -ItemType Directory -Force $jarInput | Out-Null
|
|
& jar --create --file $jar --manifest (Join-Path $classes "META-INF\MANIFEST.MF") -C $classes .
|
|
|
|
# 3. Determine the minimal module set for a slim runtime.
|
|
$mods = (& jdeps --multi-release 21 --ignore-missing-deps --print-module-deps $jar).Trim()
|
|
Write-Host "Modules: $mods"
|
|
|
|
# 4. Build the native app-image with a jlinked, bundled runtime.
|
|
Move-Item $jar $jarInput
|
|
& jpackage --type app-image `
|
|
--name "VncThumbnailViewer" --app-version "1.4.2" --vendor "DJC" `
|
|
--input $jarInput --main-jar "VncThumbnailViewer.jar" --main-class "VncThumbnailViewer" `
|
|
--add-modules $mods --dest $dist
|
|
|
|
Remove-Item $work -Recurse -Force -ErrorAction SilentlyContinue
|
|
Write-Host "Done -> $dist\VncThumbnailViewer\VncThumbnailViewer.exe"
|