2

I want to debug my application that is using SunPCKS11 class. Oracle's JDK doesn't come with sources for PKCS11 libraries, so I downloaded the OpenJDK source for that class from github.

However, when I attach sources from that file, Eclipse doesn't recognize it and gives me "The source attachment does not contain the source for the file SunPKCS11.class".

I also tried downloading the whole PKCS11 sources folder and packaged it in JAR. The directory structure in JAR looks like this: sun/security/PKCS11, but again, when I attach the JAR as a source it isn't recognized by Eclipse.

Note that I still use Oracle's JDK, not OpenJDK. I just want to use sources from OpenJDK.

Does anyone know how acually Eclipse recognize source files and decide if the source is valid?

user3362334
  • 1,980
  • 3
  • 26
  • 58
  • Is it under Windows? In the Windows package you can choose whether to have sources installed. There are some unspecified differences between OpenJDK and Oracle's JDK. This could be one of them. – coladict Apr 18 '18 at 12:30
  • Yes, it's Windows. But I didn't understand your question completely. Yes, I have sources installed as I installed Oracle's JDK not JRE. But, it turned out that Oracle's JDK doesn't contain the sources for PKCS libraries. That's why I'm trying to force Eclipse use the OpenJDK's soruce – user3362334 Apr 18 '18 at 13:11

1 Answers1

2

To answer my own question. I made a mistake by putting the sources I downloaded to sun/security instead of sun/security/pkcs11. And the package name of the class I was trying to debug is package sun.security.pkcs11 so I needed to have the right folder structure which answers my second question:

Eclipse looks for sources by searching for the source file in folder structure that corresponds to the fully qualified class name.

user3362334
  • 1,980
  • 3
  • 26
  • 58