7

I'm setting up a new machine and installing sdkman on Cygwin to install Java. I had this exact setup working on my previous machine, also Win 10.

Installed Cygwin, and required for sdkman, installed zip and unzip packages. Now I'm getting the following error:

$ sdk i java 11.0.3-zulu

Downloading: java 11.0.3-zulu

In progress...

Warning: Failed to create the file
Warning: /home/whyph/.sdkman/tmp/D2txrZkztdcZKSIltTtxclUhHkzF9yIf.bin: No such
Warning: file or directory

curl: (23) Failed writing body (0 != 14095)
mv: cannot stat '/home/whyph/.sdkman/tmp/D2txrZkztdcZKSIltTtxclUhHkzF9yIf.bin': No such file or directory

Tried disabling Windows firewall and running Cygwin as administrator, neither changed the error. Worked out of the box on my last machine, but can't figure out what might be different.

Philip
  • 697
  • 7
  • 20
  • 1
    As recommended, I updated to the latest Cygwin and added curl to the Cygwin setup. NOTE: I did NOT have to reinstall Cygwin or SDKMAN. – Remi Pelletier Jan 22 '20 at 22:23

4 Answers4

21

I discovered the problem - wrong curl. Turns out, Windows 10 now comes with curl and it's on your path. I assumed it was one of the base packages of Cygwin, but it is not, and the Windows version is not compatible with SDKMAN, even though it worked to install it. Fix:

  1. Remove SDKMAN per https://sdkman.io/install Uninstallation section
  2. Close Cygwin shells
  3. Rerun Cygwin setup and insure the curl, zip, unzip, and tar packages are installed (check installation instructions in case more dependencies are added since this writing)
  4. Install SDKMAN per instructions
Philip
  • 697
  • 7
  • 20
4

Recently I had the very same problem, and the reason was very simple... I forgot to install cURL on my Cygwin. Hope it helps!

Daniel Engel
  • 53
  • 1
  • 5
  • 1
    Indeed, the command `which curl` should yield something like `/usr/bin/curl`. And not some obscure windows-specific location. – Bas Dec 15 '19 at 11:18
1

I had the same problem recently and I manage to make it work somehow.

In the sdkman source file, I modified the .sdkman/src/sdkman-install.sh line 150.

I replaced the "--output" of the line below by a classic redirection ">". After I just restarted cygwin and the command finally worked.

__sdkman_secure_curl_download "${download_url}" --output "${binary_input}"

Hope that helps !

ranshao
  • 11
  • 1
  • Appreciate it, but this did not solve it for me. Luckily, I discovered the solution, see my answer. – Philip Jun 10 '19 at 20:04
1

steps to install SDKMAN on windows

Run Windows Terminal in Admin rights. open git bash inside. (Ctrl + Shift + 4)

enter image description here

winget install -e --id GnuWin32.Zip
mkdir ~/bin
cp /usr/bin/unzip ~/bin/zip
curl -s "https://beta.sdkman.io" | bash
source "/c/Users/ajink/.sdkman/bin/sdkman-init.sh"
sdk selfupdate force

After you can install Java like this.

sdk install java 17.0.2-open

Done ! :)

STEEL
  • 8,955
  • 9
  • 67
  • 89