How to extract ONLY the contents of the JDK installer

前端 未结 8 2085
[愿得一人]
[愿得一人] 2021-02-05 17:51

I just downloaded the Java SDK/JDK versions 5 and 6, and I just need the development tools (and some libraries) contained in the installation packages, I don\'t need to perform

8条回答
  •  Happy的楠姐
    2021-02-05 18:12

    I've created cygwin script to do that: https://gist.github.com/4ndrew/f9dca61cedf0e8340b54

    #!/bin/sh
    # usage example: prepareJdk.sh jdk-7u67-windows-x64.exe (result will be in jdk/)
    # Requires: p7zip, unzip
    
    JDK_EXE=$1
    7z x -ojdk "$JDK_EXE"
    unzip jdk/tools.zip -d jdk/
    
    find jdk/ -type f \( -name "*.exe" -o -name "*.dll" \) -exec chmod u+rwx {} \;
    
    rm jdk/tools.zip
    find jdk/ -type f -name "*.pack" | while read eachFile; do
       echo "Unpacking $eachFile ...";
      ./jdk/bin/unpack200.exe $eachFile ${eachFile%.pack}.jar;
      rm $eachFile;
    done
    

提交回复
热议问题