0

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?

5
  • You can create a symbolic link or mount so //hostname points to the same thing as windows mounts. You can setup automounts to do the same thing automagically. Commented Sep 29, 2016 at 11:43
  • @Peter: Could you please elaborate more as I did not understand? And thanks for quick reply. Commented Sep 29, 2016 at 11:46
  • In linux you can add mount points to anywhere you need them to be, either statically or dynamically, If you add a mount point for //hostname or //IPaddress it will point to either the samba or nfs mount of your choice. In any case, how File is used to fine files/directories this is entirely down to OS configuration rather than Java. Commented Sep 29, 2016 at 12:03
  • Could you please explain how to mount a point in OpenSUSE? as I am new to Linux. Commented Sep 30, 2016 at 13:31
  • I would read this tr.opensuse.org/SDB:Access_to_Windows_Shares Commented Sep 30, 2016 at 18:06

1 Answer 1

1

You have to use File.separator present in java lib

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.