문제

I'm trying to get a list of Files of a smb-share secured with user and password. This is working perfectly. But if I try to open a file on the smb-share, windows requires me to login again in an prompt. I have the required username and password. Can I do the login in code before opening the file?

Accessing the files with jcifs:

        NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication(
                rootFolderPath, user, passwort);
        SmbFile smbServer;
        try {
            smbServer = new SmbFile("smb://" + rootFolderPath, auth);

        } catch (MalformedURLException e) {
            e.printStackTrace();
            continue;
        } catch (SmbException e) {
            e.printStackTrace();
        }
도움이 되었습니까?

해결책

A solution is the usage of a "net use"

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top