4

I'm studying the javax.smartcardio classes. I'm using eclipse 3.6 and I have JDK 6 SE. I can use the statement import javax.smartcardio.* or any of its individual classes, as long as I change preferences to warn or ignore forbidden references.

I don't see any mention of javax.smartcardio in the standard documentation at Java SE 6 and no javadoc help pops up in eclipse. I have found docs here.

Is there a way of linking Eclipse to the javadocs for smartcardio?

NickT
  • 23,844
  • 11
  • 78
  • 121

4 Answers4

13

I found a WebLog about it (Konstantin Flitschew WebLog (german)). It's in german but it worked for me, so I give a short translation here:

  1. create a java project or open an existing project
  2. right-click the project and open the properties dialog
  3. select build path -> libraries tab and unfold the "JRE System Library" tree
  4. select the entry "Access Rules" and push the "edit" button on the right
  5. you can apply a rule with the "add" button: set the drop down to "accessible" and enter the value “javax/smartcardio/**”

With this setting I was able to access the classes of javax.smartcardio.

Mathe
  • 131
  • 1
  • 3
10

I've asked Sun back in the day multiple times to include the javax.smartcardio in the documentation, but they have refused all the times. Now it seems that 64 bit Java version 6/7 for Windows do not have javax.smartcardio, and that the access rules rule out using it directly. This is pretty strange as javax.smartcardio seems to be an accepted JSR.

Sun and Oracle don't really communicate well regarding security API's. They are relatively well designed, but the support is lacking, and they do introduce features out of the blue.

[EDIT]

Although the javax.smartcardio package is an accepted JSR, the umbrella JSR's for Java 6 and 7 SE don't include it. See java_se-fr-spec.zip for more information (see below). So javacardx.smartcardio it is not part of the Java SE standard API. Nowadays you may have trouble accessing the API even if it is present. And you cannot add your own as it may be present for a particular edition. You can use Eclipse access rules to enable javax.smartcardio and remove access violations from your "Problem view".

Java 8 from Oracle does include an javax.smartcardio implementation. You may still have to configure access to it.

JSR 268, the Java Smart-Card I/O API, will not be included because the JSR 270 Expert Group concluded that it would not be of sufficiently wide interest in the Java SE 6 time frame.

Maarten Bodewes
  • 90,524
  • 13
  • 150
  • 263
  • Useful and accepted answer. It looks like they are making a feeble attempt to keep all chip and pin stuff hidden, inconveniencing legitimate developers. All the crooks will just write their own low level jars and legitimate coders will just have to do the same I guess. – NickT Feb 22 '12 at 22:39
  • By the way, you can find the API docs on the internet (the JSR pages seem to have them). I've reintegrated them with the core documentation a few times already. Just unpack the docs, merge them, and possibly pack them again. – Maarten Bodewes Feb 22 '12 at 23:27
  • @MaartenBodewes do you have any updates (if there are any) on this with regard to actual support in current implementations? Also, you might want to cite [this](https://docs.oracle.com/javase/8/docs/technotes/guides/security/enhancements-6.html): "*Sun's Java SE 6 implementation bundles the Smart Card I/O API [...] as well as a provider called SunPCSC which uses the platform's native PC/SC Smart Card stack [...] neither the API nor the SunPCSC provider are part of the Java SE 6 platform specification and may not be present on other compliant Java SE implementations.*" – Michael Roland Apr 30 '15 at 19:11
  • 1
    @MichaelRoland I think there is more support by now in the JRE's, but the API documentation is still not configured on the web-site. Pretty annoying, but hardly surprising since my bug report was denied. – Maarten Bodewes Apr 30 '15 at 19:15
  • @MaartenBodewes It's indirectly linked from https://docs.oracle.com/javase/8/docs/ though ("Security" in the "Other Base Libraries" section of the diagram) – Michael Roland Apr 30 '15 at 19:57
  • @MaartenBodewes Btw. I asked for updates (or a report on personal experiences) as [this question](http://stackoverflow.com/q/29960521/2425802) (which explicitly asked for Java SE 7/8) was closed as a duplicate today. – Michael Roland Apr 30 '15 at 20:03
  • 1
    @MichaelRoland Yeah, that's the problem with these kind of questions, the JRE is a moving target... Same goes for the JavaDoc of smartcardio. It's available, but it's not included in the official API so e.g. Eclipse cannot find the package from the internal help function. – Maarten Bodewes Apr 30 '15 at 20:06
0

Oracle's JDK does not contain the javadoc for javax.smartcardio at all. Use OpenJDK instead.

Install OpenJDK from https://adoptopenjdk.net/, then add it in Eclipse using Window -> Preferences -> Java -> Installed JREs (in Windows the path you need looks like C:\Program Files\AdoptOpenJDK\jdk-8.0.242.08-hotspot). The result:

screenshot

Pe Wu
  • 533
  • 4
  • 12
-1

I was in the same situation as you were but then I found this http://intelligenzija.net/?q=node/1 Basically you need to set Access rules for these classes in the IDE so you can use them.

mapuo
  • 1
  • 1
  • 1
  • 2
    That site is "under construction" and doesn't show anything.... will look for other references explaining how to set access rules in Eclipse – Andrew Mackenzie Jun 01 '12 at 20:02