Java and Openssl generates different length of public keys for same private key

The keys are identical, and should decode to the same byte content.

Formatting-wise, the Java one is wrapped at 76 columns and the OpenSSL one is wrapped at 64 columns.

If you want to make the wrapping consistent, use the Base64.getMimeEncoder(int lineLength, byte[] lineSeparator) overloaded method that lets you specify the line length and pass 64 as the lineLength parameter.

Base64.getMimeEncoder(64, new byte[] {'\r', '\n'});