Skip to content

Set bundled JDK home in netbeans.conf via ${BASEDIR} (#133) - #147

Open
geertjanw wants to merge 1 commit into
masterfrom
issue-133-windows-open-with
Open

geertjanw wants to merge 1 commit into
masterfrom
issue-133-windows-open-with

Conversation

@geertjanw

Copy link
Copy Markdown
Member

Fixes #133.

The Windows installer passed the bundled JDK via --jdkhome on the Start Menu / desktop shortcut. Launching the executable directly — e.g. via Open With… on a file — bypassed the shortcut, so the bundled JDK wasn't found and the launcher fell back to a system JDK or failed to start.

With the launcher now supporting ${BASEDIR} substitution (apache/netbeans#8408), the bundled JDK can be referenced from netbeans.conf relative to the install, so it's found however the app is launched.

Change

  • AbstractPackagerTask.addRuntimeToConf now writes the bundled JDK location as ${BASEDIR}/<jdk> and sets both jdkhome and netbeans_jdkhome (resolving the long-standing @TODO there). Previously it wrote a plain relative path under only jdkhome, which didn't resolve for direct launches.
  • Separators are normalised to /, which the Windows launcher tolerates.

Decisions (per the open questions in the issue)

  • Scope: applied in the shared conf handling, so it benefits every packager that bundles the runtime inside the app dir (deb/rpm/appimage/windows). macOS is unaffected (its runtime lives outside the app dir, so this path isn't taken). Where other launchers still pass --jdkhome on the command line, that continues to take precedence, so there's no regression.
  • Shortcut --jdkhome: kept. The conf entry fixes direct/Open-With launches additively, while the shortcut keeps older NetBeans launchers (without ${BASEDIR} support) working. Zero regression.
  • 32-bit launcher: left in place — out of scope for this fix; can be a separate change.

Tests

  • TestUtils.buildFakeApp now seeds the .conf with the #jdkhome / #netbeans_jdkhome placeholders.
  • InnoSetupPackagerTest.testImageWithX86_64Runtime asserts both keys are rewritten to ${BASEDIR}/jdk.
  • Full suite passes locally.

Still needs real-world validation

As the issue notes, this should be tested with both the IDE and a platform app on Windows (and ideally the direct Open-With case) before release.

The Windows installer set the bundled JDK via --jdkhome on the Start
Menu shortcut, so launching the executable directly - eg. via
"Open With..." on a file - did not find the bundled JDK and either fell
back to a system JDK or failed to launch.

Write the bundled JDK location into netbeans.conf relative to the
installation using the launcher's ${BASEDIR} token (now supported by the
IDE and platform launchers), setting both jdkhome and netbeans_jdkhome.
This resolves however the application is launched. The shortcut
--jdkhome parameter is kept so packaging of older launchers that lack
${BASEDIR} support is unaffected.

This applies to all packagers that bundle the runtime inside the
application directory; the previous plain relative path was replaced.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update Windows packaging to support Open With... on files

1 participant