Skip to content

Rework java for dropping of javah - #4948

Merged
bdbaddog merged 1 commit into
SCons:masterfrom
mwichmann:javac-rework
Nov 11, 2026
Merged

bdbaddog merged 1 commit into
SCons:masterfrom
mwichmann:javac-rework

Conversation

@mwichmann

@mwichmann mwichmann commented Nov 10, 2026 •

Copy link
Copy Markdown
Collaborator

Now use javac -h - required some pieces moving around.

Modernize support for generating JNI headers, since the javah command was removed in JDK 10. If no javah is found, the JavaH builder now drives javac -h (available since JDK 8) instead, so existing build descriptions keep working. Header files are still declared as build targets, and only classes declaring native methods are declared, matching what javac -h generates, so dependency tracking (including C/C++ #includes of the headers) and incremental rebuilds behave correctly. A single File target (the legacy javah -o mode) has no javac -h equivalent and now raises a clear error when it would be used. The User Guide and tool docs were reworked to present the javac -h mechanism as the normal path, with javah described as the legacy fallback.

This change was AI-assisted.

Closes #3347

Contributor Checklist:

  • I have created a new test or updated the unit tests to cover the new/changed functionality.
  • I have updated CHANGES.txt and RELEASE.txt (and read the README.rst).
  • I have updated the appropriate documentation

Now use javac -h - required some pieces moving around.

Modernize support for generating JNI headers, since javah command was
removed in JDK 10. If no javah is found, the JavaH builder now drives
"javac -h" (available since JDK 8) instead, so existing build descriptions
keep working.  Header files are still declared as build targets, and only
classes declaring native methods are declared, matching what javac -h
generates, so dependency tracking (including C/C++ #includes of the headers)
and incremental rebuilds behave correctly. A single File target
(the legacy javah -o mode) has no javac -h equivalent and now raises
a clear error when it would be used. The User Guide and tool docs were
reworked to present the javac -h mechanism as the normal path, with
javah described as the legacy fallback.

This change was AI-assisted.

Closes SCons#3347

Signed-off-by: Mats Wichmann <mats@linux.com>
@mwichmann mwichmann added the Java Java tools and language support label Nov 10, 2026
@mwichmann mwichmann moved this to In review in Next Release Nov 10, 2026
@bdbaddog

Copy link
Copy Markdown
Contributor

So at least for this purpose we're dropping support for Java < 8?
If so we should be explicit about that in the docs and CHANGES/RELEASE.txt

(Though I highly doubt anyone using current SCons is still using Java < 8, we should make it very clear, normally we'd have to do a deprecation cycle, but I think in this case we can skip it)

@bdbaddog
bdbaddog merged commit e31a551 into SCons:master Nov 11, 2026
13 checks passed
@github-project-automation github-project-automation Bot moved this from In review to Done in Next Release Nov 11, 2026
@mwichmann mwichmann mentioned this pull request Nov 11, 2026
1 of 5 tasks
@mwichmann mwichmann added this to the NextRelease milestone Nov 11, 2026
@mwichmann
mwichmann deleted the javac-rework branch November 11, 2026 23:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Java Java tools and language support

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Java 11 support issues

2 participants