RFC: java.awt.Desktop methods should accept Path in addition to File

Markus KARG markus at headcrashing.eu
Sat Mar 15 18:25:27 UTC 2025


Since Java 7 there is java.nio.file.Path as a modern alternative to 
java.io.File. Many APIs in OpenJDK make use of Path already, but not 
java.awt.Desktop. This forces authors of new desktop applications to 
convert to File explicitly. While it is understood there are not masses 
of such applications newly authored, still there are some, and their 
authors contacted me regarding this.

I would be happy to provide a PR which adds alternative signatures 
allowing to pass Path directly. The change would be very small hence 
quick to review, mostly cheap to maintain, and at most risk-free, as it 
simply internalizes code that otherwise would exist externally.

Comments appreciated!

Regards

-Markus Karg



More information about the client-libs-dev mailing list