How to extract ONLY the contents of the JDK installer

前端 未结 8 1973
[愿得一人]
[愿得一人] 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条回答
  • 2021-02-05 17:56

    You can extract both JDK 1.5 and 1.6 from .exe files, using the Universal Extractor (really a great tool). But don't forget to convert all *.pack files (compressed with Pack200 format) into corresponding *.jar files, in order to obtain a full working environment. You can use the unpack200.exe command provided in the JDK itself.

    0 讨论(0)
  • 2021-02-05 18:01

    You can do the installation once and then zip up the installed stuff placed under \Programs\Java.

    This can be unzipped elsewhere later and used as a JDK in most IDE's without needing a full reinstall (but then Windows does not know about it)

    0 讨论(0)
  • 2021-02-05 18:01

    Here's .bat script for unpacking "pack" files. Must be run in the root of unzipped JDK.

    @echo off
    echo **********************
    echo unpack JDK pack-files
    echo **********************
    pause
    
    set JAVA_HOME=c:\glassfish4\jdk7
    
    setlocal enableextensions
    for /r %%f in (*) do call :process %%f
    endlocal
    goto :eof
    
    :process
    if NOT "%~x1" == ".pack" goto :eof
    set FOLDER=%~p1
    
    set PWD=%CD%
    pushd %FOLDER%
    echo Unpacking %~nx1
    %JAVA_HOME%\bin\unpack200.exe %~nx1 %~n1.jar
    popd
    
    goto :eof
    
    0 讨论(0)
  • 2021-02-05 18:05

    I use 7-zip to do that. It seems to handle that installer/self-extracting executables nicely.

    0 讨论(0)
  • 2021-02-05 18:10

    Maybe you can try Universal Extractor. The site looks legit, but I haven't tried it myself.

    0 讨论(0)
  • 2021-02-05 18:11

    a little late to the party

    here's an extractor written in powershell

    param($installdir)
    
    $list=$(gci -Recurse ./$installdir/*.pack) | %{
        return @{
            source=$_.FullName
            parent=$_.Directory.FullName
            target="$($_.Directory.FullName)\$([io.path]::GetFileNameWithoutExtension($_.Name)).jar"
        }
    } | %{
        $result = $(unpack200 $_.source $_.target)
        $_result=$result
        return $_
    }
    
    Write-Host $(ConvertTo-Json $list)
    
    0 讨论(0)
提交回复
热议问题