$ErrorActionPreference = 'Stop' $Root = Split-Path -Parent $PSScriptRoot $Temp = Join-Path ([System.IO.Path]::GetTempPath()) ([guid]::NewGuid().ToString()) New-Item -ItemType Directory -Path $Temp | Out-Null try { & javac --release 11 -d $Temp (Join-Path $Root 'hmi-docs/cheerpj/WorkplaceLauncher.java') if ($LASTEXITCODE -ne 0) { throw 'Workplace launcher compilation failed' } & jar --create --file (Join-Path $Root 'hmi-frontend/public/cheerpj/workplace-launcher.jar') -C $Temp 'com/widgetworkbench/cheerpj/WorkplaceLauncher.class' if ($LASTEXITCODE -ne 0) { throw 'Workplace launcher packaging failed' } } finally { Remove-Item -LiteralPath $Temp -Recurse -Force }