Sajed Hamdan
Sajed Hamdan

Reputation: 11

javax.smartcardio cannot be resolved after updating Maven project to Java 17

I recently updated my Maven project from Java 8 to Java 17. After the update, I encountered an issue where Eclipse cannot resolve javax.smartcardio.* imports in my project. I found a workaround by adding java.smartcardio as a system module through Eclipse's project settings (Configure Build Path -> Module Dependencies -> add System Module -> java.smartcardio).

However, every time I update my Maven project (Right click on project -> Maven -> Update Project), the java.smartcardio module gets removed, and I have to add it again manually.

I found a similiar post, however all provided solutions still encounter the issue where java.smartcardio module gets removed when maven project is updated.

Reference link: How to add module 'java.smartcardio' in a non-modular JavaFX application?

Is there a permanent solution to this issue?

I tried adding java.smartcardio module as a system module manually to the Eclipse .classpath file of my project:

 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17">
        <attributes>
            <attribute name="module" value="true"/>
            <attribute name="limit-modules" value="java.se,jdk.accessibility,jdk.dynalink,jdk.httpserver,jdk.incubator.foreign,jdk.incubator.vector,jdk.jartool,jdk.javadoc,jdk.jconsole,jdk.jshell,jdk.jsobject,jdk.management.jfr,jdk.net,jdk.nio.mapmode,jdk.sctp,jdk.security.auth,jdk.security.jgss,jdk.unsupported,jdk.unsupported.desktop,jdk.xml.dom,java.smartcardio"/>
            <attribute name="maven.pomderived" value="true"/>
        </attributes>
    </classpathentry>

However, this did not solve the issue when updating maven project where the smartcardio module was removed.

Upvotes: 1

Views: 236

Answers (0)

Related Questions