I have two computers connected in LAN lets say A and B, where A is server and B is client. I have created Java appln using that I want to create folder at A from B. In normal situation I used following code to create folder.
But this code does not work here. I tried to provide IP address in front of it.
But it gave me error.
The specified path, file is invalid.
Can you tell me guys how to create.
Thank you in advance.
First of all, to access a folder on a remote folder using network shares, that folder must be actually shared. On Windows you often get that for free since all drives are shared out-of-the-box. Instead of D:, you need to use D$ (so replace the : with a $). If this doesn't work, you must create an explicit share.
That's not enough though. You also need to tell on which machine the share is located. This is done using \\machinename. In your case, the total path would become \\192.168.1.9\D$\ESM\Student. Next you need to escape all those backslashes if you need to create a string with that value. That indeed means the value will start with 4 backslashes in the code.
Note that you can also use forward slashes which you don't need to escape. I prefer those because it's clearer.
Did you have to provide credentials when you created the network mapping? If so then java.io.File won't be able to help you; it simply cannot handle shares that require you to login. You should check out JCIFS or a similar library instead.