0

我已经在 Windows server 2012 上通过 NFS 启用并共享了一个目录。我使用 Xfile 库来访问它,但我无法访问它。以下是我尝试连接到 NFS 的代码。

import java.io.*;
import java.net.*;
import com.sun.xfile.*;
import com.sun.nfs.*;

public class ClientPro {

/**
 * @param args the command line arguments
 */
public static void main(String[] args) {

   try {
           XFile xf = new XFile("nfs://172.25.16.211//nfs//abc.txt");
           if (xf.exists())
           {    
                System.out.println("DIR or File Exist");
                if (xf.canRead())
                {    
                    System.out.println("DIR or File is Readable");
                }else{
                    System.out.println("DIR or File is Not Readable");
                }
            }else
                System.out.println("DIR or File not Exist");
            } catch (Exception e) {
                System.out.println(e);
            }

       }
 }

上述代码的输出是:DIR 或文件不存在

4

0 回答 0