Accessing folder from Linux machine from Windows a

2019-09-16 01:44发布

问题:

I have created shared folder (common_folder) on Linux, which I want to access by Windows as well as Linux System.

Programming language is Java. I am using "//IP address/common_folder" as folder path so that it will be accessible to both Linux and Windows.

{{ File folder = new File("//IP address/common_folder"); }}

When I am trying to get the folder using above line in Linux machine, it gives folder path as: "/root/eclipse///IP address/common_folder". However I want only '//IP address/common_folder' as a folder path because my folder is available on that path.

How to get the folder of mentioned path in Linux using java?

回答1:

You have to use File.separator present in java lib