Java 当文件名包含Windows 8.1上的特殊字符时,无法使用Runtime.getRuntime().exec打开文件

Java 当文件名包含Windows 8.1上的特殊字符时,无法使用Runtime.getRuntime().exec打开文件,java,windows-8.1,runtime.exec,rundll32,Java,Windows 8.1,Runtime.exec,Rundll32,我尝试使用以下代码在Windows8.1上打开一个特定的文件 public static void main(String[] args) throws Exception { if (args.length > 0) { File file = new File(args[0]); if (file.exists()) { try {

我尝试使用以下代码在Windows8.1上打开一个特定的文件

public static void main(String[] args) throws Exception
{
    if (args.length > 0)
    {
         File file = new File(args[0]);
         if (file.exists())
         {
             try
             {
                 Runtime.getRuntime().exec(new String[]{"rundll32", "url.dll,FileProtocolHandler", file.getAbsolutePath()});
             }
             catch(Exception e)
             {
                 e.printStackTrace();
             }
         }
         else
         {
             System.out.println("File does not exist");
         }
    }
}
如果文件名中有特殊字符,则无法打开该文件

例如:
args[0]=新正如意 新年发财.txt

我如何解决这个问题


提前感谢

可能的副本,请使用
桌面试用。打开(文件)
。。