-2

I have problems with the following method:

sun.security.x509.AuthorityKeyIdentifierExtension.getEncodedKeyIdentifier()

It exists in openJDK but it does not exist in oracleJDK. I always thought that except for some special cases regarding licensing those JDKs should be the same ...

While I can work around that issue, I fear there are other incompatibilities I might not be aware of.

Steffen Heil
  • 4,286
  • 3
  • 32
  • 35
  • 1
    That's a sun package. I doubt that it's guaranteed to always be available the way that java and javax packages are. OpenJDK probably lags behind Oracle's implementation. – duffymo Sep 19 '16 at 14:52
  • There is a specific warning against using `sun.*` packages in the Javadoc, and it's been there for 20 years. – user207421 Oct 01 '16 at 11:46

3 Answers3

0

That class is not part of the public Java API and is therefore not guaranteed (or even likely) to exist in every JRE implementation, nor every release of the same provider's implementation.

If it's not part of the standard APIs, then you can't count on it.

While the OpenJDK and OracleJDK implementations happen to be very similar as they share a common history, they could diverge (or converge) in any private APIs or implementation details at any time, simply because they are separately-run projects.

Instead you should be using the appropriate implementation-agnostic APIs in java.security and javax.security for dealing with certificates.

OrangeDog
  • 36,653
  • 12
  • 122
  • 207
  • 1
    I know that, but that was not the question. There are statements that both jdks are build from the same source and my finding seams to contradict that. – Steffen Heil Sep 19 '16 at 15:08
  • 1
    I decided to concentrate on the X of your [XY problem](http://meta.stackexchange.com/a/66378/155659). – OrangeDog Sep 19 '16 at 15:16
  • The actual answer is pretty boring (and I have touched on it in the middle paragraph) - even if they built from exactly the same source repository, they don't release at exactly the same time, and there is no 1-to-1 correspondence of version numbers. – OrangeDog Sep 19 '16 at 15:17
0

Classes that are not part of the standard packages and classes that are deprecated can be not part of a jdk.

In your case you can try to solve the problem using the classes of the package javax.security.cert. Searching for it on google you can find some tutorials like this one.


Just to complete the answer is true that "generally" both compiled code comes from the same source code in the open jdk and in the oracle jdk. But oracle jdk and open jdk have different licences so there are also few little differences. Generally the differences are not related to the source of common classes, but to the presence or absence of classes or entire packages. As an example see the font library.

This is not the only difference. As you noted in your code also the security packages are different, because the open jdk added also the old sun version of x509 certificate classes and the oracle jdk not. There is no guarantee on what classes are included or not if they are not part of the standard packages. So if you have problems running your code on different jdk environments use only standard packages or explicitly import libraries as you need.

Davide Lorenzo MARINO
  • 26,420
  • 4
  • 39
  • 56
-1

Oracle JDK was previously called SUN JDK and that was before the takeover by Oracle. Earlier, it was the official proprietary implementation of the Java language. After the takeover it was named as Oracle JDK and Oracle’s team maintains the JDK.

OpenJDK is an open source implementation of the Java Standard Edition platform with contribution from Oracle and open Java community.

Actually, Oracle JDK’s build process builds from OpenJDK source code. So there is no major technical difference between Oracle JDK and OpenJDK.

Apart from the base code, Oracle JDK includes, Oracle’s implementation of Java Plugin and Java WebStart. Also includes third party closed source and open source components like graphics rasterizer and Rhino respectively.

How Oracle JDK and OpenJDK is kept in Sync: All of the development and bug fixes happens in OpenJDK and then they are propagated to the Oracle JDK. Security fixes happens in private forest without public code reviews unlike general fixes, then they are pushed to Oracle JDK and then to OpenJDK.

more on http://javapapers.com/java/oracle-jdk-vs-openjdk-and-java-jdk-development-process/

Md Ayub Ali Sarker
  • 10,795
  • 4
  • 24
  • 19
  • 1
    I know about that description, but if it was true, how could both end up with different methods in the same classes? – Steffen Heil Sep 19 '16 at 15:06
  • 1
    @SteffenHeil If you knew that, you should have included your previous research in the question. – OrangeDog Sep 19 '16 at 15:55
  • @OrangeDog Why? It's self-evident that the two aren't built from the same source code, as asserted in this answer. Othewise the problem being asked about wouldn't exist. – user207421 Oct 01 '16 at 11:45