3

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

  • 2
    What do you mean "what happend" - It still exists https://docs.oracle.com/javase/10/docs/api/javax/smartcardio/package-summary.html – Wulf Aug 28 '18 at 09:37
  • 1
    I read that as Smart Cardio and wondered when Java started to have such specific support for things... – Kayaman Aug 28 '18 at 09:46
  • @Kayaman Since 1.6 – Wulf Aug 28 '18 at 09:55
  • @Wufo I meant I read that as Smart Cardio, i.e. workout related functionality. Not Smart Card IO. – Kayaman Aug 28 '18 at 10:24
  • Oh ok. sorry... – Wulf Aug 28 '18 at 10:47
  • The documentation is often not available in the offline documentation package. You may be tricked because of that that is doesn't exist. I filed [this bug report before](https://bugs.java.com/bugdatabase/view_bug.do?bug_id=6549100) but the they decided that devs don't need documentation if it is not part of the Java spec (which is - to me - one of the most idiotic reasoning I've ever heard. – Maarten Bodewes Sep 30 '18 at 02:50

2 Answers2

3

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

Chemah
  • 538
  • 6
  • 18
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.

enter image description here

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

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

T. Short
  • 3,481
  • 14
  • 30