Skip to content

Hello, Not work in Win11 #9

@nameHui

Description

@nameHui

in win10 it's work . in win 11 , this line TwainIdentity id = (TwainIdentity) ids.next() error;
why we can cast java.util.concurrent.Semaphore to free.lucifer.jtwain.TwainIdentity
how to fiexd this question, can you provide some suggestions,thanks

public String[] getDeviceNames() throws TwainException {
    List<TwainIdentity> identities = new ArrayList<>();

    Twain.getIdentities(this, identities);

    String[] names = new String[identities.size()];
    Iterator<TwainIdentity> ids = identities.iterator();
    for (int i = 0; ids.hasNext(); i++) {
        TwainIdentity id = (TwainIdentity) ids.next();
        names[i] = id.getProductName();
    }
    return names;
}

Unhndled exception
java.lang.ClassCastException: java.util.concurrent.Semaphore cannot be cast to free.lucifer.jtwain.TwainIdentity
at free.lucifer.jtwain.TwainScanner.getDeviceNames(TwainScanner.java:64)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions