Java, JFileChooser, and password protected Windows network resources

I need to present to the user or my application a dialog in which this points to a specific file, so naturally, the easiest choice is to use JFileChooser.

However, the file to be selected is located on the / share Windows network drive, but it maps to the drive on the host computer on which my application is running. The IS network access package, while JFileChooser presents the disk in its dialog, but it cannot browse the disk until I use another program, for example. Windows Explorer to view a network share where it will request a password.

Is it possible for JFileChooser to ask the user for a password? Does JFileChooser receive a notification from the system that password / authentication is required? Using the Sun example here , it just fails, and that is NOT what I want. I want the user to be prompted for a password. Can I do it?

+6
source share
1 answer

PasswordAuthentication may come in handy in this case. An example can be found here.

+1
source

Source: https://habr.com/ru/post/908769/


All Articles