我看到新的 Desktop 类(我想将其用于其 browse(uri) 方法)包括检查以验证它是否受支持。如果我为多个操作系统分发我的应用程序,我是否应该预料到它有时会不受支持,并坚持使用像 this "Bare Bones Browser Launch" 这样的代码?作为后备方法,还是这种情况极为罕见?我可能会遇到问题的任何特定操作系统?
(我正在为 Mac/Win/Solaris/Linux 分发,但如果您了解任何特殊操作系统,请随时回答。)
最佳答案
你应该进行防御性编程。
来自 How to Integrate with the Desktop Class :
Use the isDesktopSupported() method to determine whether the Desktop API is available. On the Solaris Operating System and the Linux platform, this API is dependent on Gnome libraries. If those libraries are unavailable, this method will return false
(强调我的)
关于java - 难道Java会遇到6's Desktop.browse() likely to be unsupported on any system I'?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6960518/