Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java, JFileChooser & Windows Network Shares WITH Password Protection

I need to present to the user or my application a dialogue in which that point to a particular file so naturally the easiest choice is to use a JFileChooser.

However the file that needs to be selected is on a Windows network drive/share but it is mapped to a drive on the host computer running my app. The network share IS password and JFileChooser does present the drive in its dialoge but it cannot browse the drive until I use another program e.g. Windows Explorer to view the network share where it will ask for the password.

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

like image 660
D-Dᴙum Avatar asked Feb 18 '12 11:02

D-Dᴙum


1 Answers

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

like image 103
twid Avatar answered Sep 22 '22 13:09

twid