Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Dec 2025 13:33:50 +0100 (CET)
From:      Ronald Klop <ronald-lists@klop.ws>
To:        java@freebsd.org
Subject:   javac source & target
Message-ID:  <707700450.1043.1765456430535@localhost>

index | next in thread | raw e-mail

[-- Attachment #1 --]
Hi,

I'm looking into the PR "Mk/bsd.default-versions.mk: update JAVA_DEFAULT to 21".
  https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=272855

Quiet some work involves changing hardcoded -source -target settings to javac. Quite some ports have targets lower than 8 which is not supported by recent javac version.

/usr/local/openjdk21/bin/javac --help:
  --target <release>, -target <release>
        Generate class files suitable for the specified Java SE release.
        Supported releases: 
            8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21

Openjdk17 supports 7-17 and openjdk25 supports 8-25. Mind that java can read classes going back to version 1. It is just that the javac compiler can't generate them anymore.

To make class files usable between ports I think it is user friendly to compile targeted for the oldest JDK in the ports tree which is now openjdk8.
Or we can aim to remove the source/target definitions and compile for JAVA_DEFAULT.
Unfortunately these source/target definitions are often hardcoded in the source code of the port so we need to patch anyways.

What are your thoughts on this?

Regards,
Ronald.
 
[-- Attachment #2 --]
<html><head></head><body>Hi,<br>
<br>
I'm looking into the PR "<span id="summary_container"><span id="short_desc_nonedit_display">Mk/bsd.default-versions.mk: update JAVA_DEFAULT to 21".<br>
&nbsp;</span></span>&nbsp;<a href="https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=272855">https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=272855</a><br>;
<br>
<span><span>Quiet some work involves changing hardcoded -source -target settings to javac. Quite some ports have targets lower than 8 which is not supported by recent javac version.<br>
<br>
/usr/local/openjdk21/bin/javac --help:</span></span><br>
&nbsp; --target &lt;release&gt;, -target &lt;release&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; Generate class files suitable for the specified Java SE release.<br>
&nbsp; &nbsp; &nbsp; &nbsp; Supported releases:&nbsp;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21<br>
<br>
Openjdk17 supports 7-17 and openjdk25 supports 8-25. Mind that java can read classes going back to version 1. It is just that the javac compiler can't generate them anymore.<br>
<br>
To make class files usable between ports I think it is user friendly to compile targeted for the oldest JDK in the ports tree which is now openjdk8.<br>
Or we can aim to remove the source/target definitions and compile for&nbsp;<span id="summary_container"><span id="short_desc_nonedit_display">JAVA_DEFAULT.</span></span><br>
<span><span>Unfortunately these source/target definitions are often hardcoded in the source code of the port so we need to patch anyways.<br>
<br>
What are your thoughts on this?<br>
<br>
Regards,<br>
Ronald.</span></span><br>
&nbsp;</body></html>
home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?707700450.1043.1765456430535>