tools.jar has been removed from JDK 9+ and ant versions from 1.10.x on fully support this--therefore this warning is spurious for installations where JDK 9 and above are being utilized. If the warning needs to stay in because some developers are still using JDK 8 and below, then at the very least there needs to be a check for the correct version of the JDK ant is using and suppress the warning if it detects JDK 9 and above. I feel I should mention that this warning is not from upstream but comes from the Gentoo side. Opened because bug #730456 said to. :-) Also, bug #682136 is relevant and could be closed once this one is resolved.
I am sure no one cares but there are patches to fix this attached to bug #730456.
persists with dev-java/ant-1.10.14-r1 $ ant -version Warning: Unable to determine tools.jar location. If build fails because sun.* classes could not be found, Make sure you are using a JDK, not JRE as your user/system VM. and that you have java-config version 2.0.30 or above installed. Apache Ant(TM) version 1.10.14 compiled on Januar 23 2024
*** This bug has been marked as a duplicate of bug 682136 ***