V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
nutting
V2EX  ›  Java

zulu jdk for m1,有个坑

  •  
  •   nutting · Aug 6, 2021 · 3790 views
    This topic created in 1726 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
        1
    ahmcsxcc  
       Aug 6, 2021
    oracle 要钱咋办啊
    qwerthhusn
        2
    qwerthhusn  
       Aug 6, 2021
    别引用 sun 开头的类,到 11 的时候这些类都没法在代码中引入了,直接编译报错

    而且不知道什么场景下会直接用到 RSAPublicKeyImpl,如果真的有需要,看看 bouncycastle 的实现,用那个
    binbinyouliiii
        3
    binbinyouliiii  
       Aug 6, 2021
    google“为什么不使用 sun 包”
    echo1937
        4
    echo1937  
       Aug 6, 2021
    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
        5
    CodeCodeStudy  
       Aug 6, 2021
    你的 OpenSDK 和 Oracle SDK 分别是什么版本?
    fkmc
        6
    fkmc  
       Aug 6, 2021
    不要使用 sun
    要不用用 hutool 的工具类
    zm8m93Q1e5otOC69
        7
    zm8m93Q1e5otOC69  
       Aug 6, 2021 via Android
    别用 sun 包了
    chendy
        8
    chendy  
       Aug 6, 2021
    不是坑,本来就不是给用户的 api,不保证兼容性
    AEDaydreamer
        9
    AEDaydreamer  
       Aug 6, 2021
    不算坑吧,用 openjdk 也会有 sun 包的问题。
    hotcool100
        10
    hotcool100  
       Aug 6, 2021
    手动把 bouncycastle jar 加到编译环境~
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5742 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 55ms · UTC 07:50 · PVG 15:50 · LAX 00:50 · JFK 03:50
    ♥ Do have faith in what you're doing.