nutting
V2EX  ›  Java

zulu jdk for m1,有个坑

  •  
  •   nutting · Aug 6, 2021 · 4320 views
    This topic created in 1921 days ago, the information mentioned may be changed or developed.

    sun.security.rsa.RSAPublicKeyImpl
    RSAPublicKeyImpl(AlgorithmId rsaId, BigInteger n, BigInteger e)
    这个构造器有三个参数,但是 oracle jdk 是两个参数,假如我的代码不能动。。。完蛋。。。 而且后面 11 16 什么的一系列非 oracle 的各厂商 open jdk 都是三个参数,,,哎,这种底层有时候还得用 oracle 的

    Supplement 1  ·  Aug 6, 2021
    我靠,发现问题所在了,即使 oracle jdk,也得是 1.8.0_191 才是两个参数,反正最新版不行,是三个参数
    10 replies  •  2021-08-06 18:34:37 +08:00
    ahmcsxcc
    ahmcsxcc
    Aug 6, 2021
    1
    oracle 要钱咋办啊
    qwerthhusn
    qwerthhusn
    Aug 6, 2021
    2
    别引用 sun 开头的类,到 11 的时候这些类都没法在代码中引入了,直接编译报错

    而且不知道什么场景下会直接用到 RSAPublicKeyImpl,如果真的有需要,看看 bouncycastle 的实现,用那个
    binbinyouliiii
    binbinyouliiii
    Aug 6, 2021
    3
    google“为什么不使用 sun 包”
    echo1937
    echo1937
    Aug 6, 2021
    4
    https://stackoverflow.com/questions/29622811/open-source-replacement-for-sun-security-rsa-rsapublickeyimpl

    我记得这是个兼容性问题,你换到 Oracle JDK 高版本也是三个参数,
    而且 JDK 也注明了,这个是 internal proprietary API and may be removed in a future release
    CodeCodeStudy
    CodeCodeStudy
    Aug 6, 2021
    5
    你的 OpenSDK 和 Oracle SDK 分别是什么版本?
    fkmc
    fkmc
    Aug 6, 2021
    6
    不要使用 sun
    要不用用 hutool 的工具类
    zm8m93Q1e5otOC69
    zm8m93Q1e5otOC69
    Aug 6, 2021 via Android
    7
    别用 sun 包了
    chendy
    chendy
    Aug 6, 2021
    8
    不是坑,本来就不是给用户的 api,不保证兼容性
    AEDaydreamer
    AEDaydreamer
    Aug 6, 2021
    9
    不算坑吧,用 openjdk 也会有 sun 包的问题。
    hotcool100
    hotcool100
    Aug 6, 2021
    10
    手动把 bouncycastle jar 加到编译环境~
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   4614 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 42ms · UTC 08:50 · PVG 16:50 · LAX 00:50 · JFK 03:50
    ♥ Do have faith in what you're doing.