Search code examples
javapathdirectoryuncfiledialog

How to get the UNC path of a mapped network drive in a Java application


I'm trying to find a way to access the UNC path of a mapped network drive in my Java application.

Basically I'm saving the full path of a file that the user browses for and chooses. However, I don't want my saved path to include "J:\" and similar letters in the beginning of the path but instead the full mapped network path. How can I access that?

I have been using FileDialog to browse and choose the file but I can change that if I need to.

Thank you


Solution

  • Answer taken from the following link:

    How to retrieve the UNC path instead of mapped drive path from JFileChooser

    The answer was edited into the question.