javax.smartcardio in Java 9, 10, 11, 12… etc

蹲街弑〆低调 提交于 2021-02-05 09:18:31

问题


What happened to the javax.smartcardio library from Java 9 onwards? Is there an alternative or some way to obtain it in JAR?


回答1:


After the java becomes "Modular Development", javax.smartcardio has also been modularized.

If you want to use the package after java 9, create module-info.java.

Please see the image.

Or you can just degrade the compiler version to JDK 1.8:

https://dzone.com/articles/java-9-modularity-jigsaw




回答2:


After some hours searching on the web, thanks to the answer above, and as far as I understand, Java 9 and later are modular, which is a language improvement planned some years ago. Also, after the new Oracle rules update, some packages were moved from the SE to the EE version.

The module smartcardio is now optional, but it is still included in the SE. So if you want to use it, you have to require it in a module-info.java.

Example:

I have created this file in my maven project: src/main/java/com/module-info.java

module com.chema.nfc_rfid_reader_writer {
    requires java.smartcardio;
    exports com.chema.nfc_rfid_reader_writer;
}

And that's all

https://stackoverflow.com/a/59477660/7287324 https://www.oracle.com/corporate/features/understanding-java-9-modules.html

https://docs.oracle.com/en/java/javase/11/docs/api/index.html https://docs.oracle.com/en/java/javase/11/docs/api/java.smartcardio/javax/smartcardio/package-summary.html



来源:https://stackoverflow.com/questions/52054619/javax-smartcardio-in-java-9-10-11-12-etc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!