Desktop.open()
を使用してファイルを開きます。いくつかのケースでは、このメソッドはIOExceptionが投げている:共有パスからファイルを開く際のIOExceptionの取得
Error message: The system cannot find the file specified.
java.io.IOException: Failed to open file:////userprofiles01/XDdata01/mm015633/Desktop/New%20folder/product/My%20Product/scripts/Logs/%5B2012-02-21%20131622-379%5D%20Interaction/log.html.
ファイルは「C:\」に置かれたときに同じコードが正常に動作しますが、ドライブ。問題は、場合にのみ表示されます:
- ファイルパスを共有ドライブ上の(ない「C:」ドライブ)であると
- ファイル・パスは、空白または「[」と「]」などの特殊文字が含まれています。
例:
フォルダまたはファイル名に空白が含まれている、すなわち "(空白)"
\\userprofiles01\XDdata01\mm015633\Desktop\Hi(space)Hello\log.html
\\userprofiles01\XDdata01\mm015633\Desktop\HiHello\log(space)1.html
フォルダ名に特殊文字が含まれている "[" と " ] "
\\filesrvwhq\india\Automation\MyProject\Mustak\[spacetest]\log.html
これについてのご意見はありますか?
おかげ
reasearchのビットの後