Create jre from OpenJDK Windows

前端 未结 10 2016
太阳男子
太阳男子 2020-12-08 09:54

We are switching from Oracle JDK/JRE to OpenJDK. Now I found only the JDK but I want to have a JRE as well from OpenJDK. This is for installing our application on the client

10条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-08 10:03

    On this site you can get jdk and jre (the jdk contains jre) https://adoptopenjdk.net/upstream.html.

    But if you need to build a jre you can use the following code in python (I have taken the answer from @SteinarH), the code assumes that you are in the jdk bin and that there is no directory called jre at the previous level.

    import os
    jmod_str =  os.popen('java --list-modules').read()
    init = jmod_str.index('@')
    end = jmod_str.index('\n')
    version = jmod_str[init:end]
    jmod_list = jmod_str.replace(version, '').replace('\n', ',') 
    jmod_list = jmod_list[:-1] if jmod_list[-1] == ',' else jmod_list
    cmd = 'jlink --no-header-files --no-man-pages --compress=2 --module-path ..\jmods --add-modules '+ jmod_list + ' --output ..\jre'
    

提交回复
热议问题