简体   繁体   English

具有密码保护的Java,JFileChooser和Windows网络共享

[英]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. 我需要向用户或我的应用程序提供一个对话框,其中指向特定文件,因此最简单的选择是使用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. 但是,需要选择的文件位于Windows网络驱动器/共享上,但它映射到运行我的应用程序的主机上的驱动器。 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 eg Windows Explorer to view the network share where it will ask for the password. 网络共享IS密码和JFileChooser确实在其dialoge中显示驱动器,但是在我使用其他程序(例如Windows资源管理器)查看要求输入密码的网络共享之前,它无法浏览驱动器。

Is it possible for the JFileChooser to request the user for a password? JFileChooser是否可以请求用户输入密码? Does JFileChooser receive notification from the system that password/authentication is required? JFileChooser是否从系统收到需要密码/身份验证的通知? Using the Sun example here , it just fails silently which is NOT what I want to happen. 这里使用Sun示例,它只是默默地失败,这不是我想要发生的事情。 I want the user to be prompted for a password. 我希望提示用户输入密码。 Can I do this? 我可以这样做吗?

在这种情况下, PasswordAuthentication可能会派上用场。例子可以在这里找到

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM