Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installing jdk with sdkman keeps reporting errors #1285

Open
3 tasks done
wxywizard opened this issue Apr 8, 2024 · 9 comments
Open
3 tasks done

Installing jdk with sdkman keeps reporting errors #1285

wxywizard opened this issue Apr 8, 2024 · 9 comments
Labels

Comments

@wxywizard
Copy link

wxywizard commented Apr 8, 2024

Question
When I use rockylinux version 9 and use sdkman to install java, it reports the same error no matter what version is installed, I don't know why this problem occurs, and I am asking for the community's help, the specific error message and system version information is in the following screenshot.

In progress...

############################################################################################ 100.0%
Download has failed, aborting!

Can not install java 21.0.2-graal at this time...

System info
CleanShot 2024-04-08 at 15 36 15@2x

@hgeraldino
Copy link
Contributor

Do you have tar installed? Can you run this with debug enabled? (on ~/.sdkman/etc/config, set sdkman_debug_mode=true)

@hgeraldino hgeraldino added the bug label Apr 14, 2024
@Talbot3
Copy link

Talbot3 commented Apr 19, 2024

please remove downloaded package, redownload will be ok.

@Talbot3
Copy link

Talbot3 commented Apr 19, 2024

i think this not check the package whether download complete .

@Talbot3
Copy link

Talbot3 commented Apr 19, 2024

code just run install script, so failed.

@rajinder-yadav
Copy link

rajinder-yadav commented Jun 23, 2024

Also getting errors trying to install java, guess the download is incomplete.
I was able to update maven without any problem.

$ sdk install java 22.0.1-tem

Downloading: java 22.0.1-tem

In progress...

################################################################################################ 100.0%

Repackaging Java 22.0.1-tem...
/usr/bin/env: ‘zip’: No such file or directory

Done repackaging...
unzip:  cannot find or open /home/yadav/.sdkman/tmp/java-22.0.1-tem.zip, /home/yadav/.sdkman/tmp/java-22.0.1-tem.zip.zip or /home/yadav/.sdkman/tmp/java-22.0.1-tem.zip.ZIP.

Stop! The archive was corrupt and has been removed! Please try installing again.
[Sat Jun 22 21:17:38][yadav@source]:~
$ sdk list java
[Sat Jun 22 21:19:02][yadav@source]:~
$ sdk install java 22.0.1-oracle

Downloading: java 22.0.1-oracle

In progress...

################################################################################################ 100.0%

Repackaging Java 22.0.1-oracle...
/usr/bin/env: ‘zip’: No such file or directory

Done repackaging...
unzip:  cannot find or open /home/yadav/.sdkman/tmp/java-22.0.1-oracle.zip, /home/yadav/.sdkman/tmp/java-22.0.1-oracle.zip.zip or /home/yadav/.sdkman/tmp/java-22.0.1-oracle.zip.ZIP.

Stop! The archive was corrupt and has been removed! Please try installing again.

Download folder

$ ls -l /home/yadav/.sdkman/tmp/
total 20
-rw-r--r-- 1 yadav yadav  931 Jun 22 21:19 hook_post_java_22.0.1-oracle.sh
-rw-r--r-- 1 yadav yadav  922 Jun 22 21:19 hook_post_java_22.0.1-tem.sh
-rw-r--r-- 1 yadav yadav  534 Jun 22 21:19 java-22.0.1-oracle.headers.tmp
-rw-r--r-- 1 yadav yadav 5157 Jun 22 21:19 java-22.0.1-tem.headers.tmp

@kstgrd
Copy link

kstgrd commented Oct 29, 2024

@wxywizard @rajinder-yadav I had the same issue as you do (MacOS Ventura in my case).
Just try run ulimit -f unlimited and then sdk install java <your_jdk_version> right after in the same terminal. Docs
If it works for you - make the change permanent by adding it to ~/.zshrc or ~/.bash_profile for your shell.

@marc0der
Copy link
Member

Hi @kstgrd, I'm struggling to see why you need to set the stack size to unlimited to fix these problems. One of the above cases seems due to bad data in out database, the other seems like an issue with zip not installed on the machine.

@BuckB
Copy link

BuckB commented Nov 13, 2024

Hi @marc0der . I run into a similar issue, I'm on a Mac (Sonoma 14.7.1) using ZSH (no frameworks, pure, raw zsh) and tried installing sdkman! in a custom directory (instead of ~/.sdkman).
Installation run flawlessly, run sdk help as suggested after install, and it seems to be alright.
It seems to work without issues until I try to install java. It downloads but the install script seems to delete the file before unpackig or moving the file elsewhere, so it fails.
Zip is installed and working. I turned on debug mode, here's the output:

~ $ sdk install java 21.0.5-amzn
Validate java 21.0.5-amzn for darwinx64: valid
Validation URL: https://api.sdkman.io/2/candidates/validate/java/21.0.5-amzn/darwinx64

Downloading: java 21.0.5-amzn

In progress...

  • SSL certificate verify ok.

  • using HTTP/1.x
    GET /2/broker/download/java/21.0.5-amzn/darwinx64 HTTP/1.1
    Host: api.sdkman.io
    User-Agent: curl/8.7.1
    Accept: /

  • Request completely sent off
    < HTTP/1.1 302 Found
    < Server: nginx/1.19.10
    < Date: Wed, 13 Nov 2024 19:59:35 GMT
    < Content-Length: 0
    < Connection: keep-alive
    < X-Sdkman-ArchiveType: tar
    < location: https://corretto.aws/downloads/resources/21.0.5.11.1/amazon-corretto-21.0.5.11.1-macosx-x64.tar.gz
    <

  • Ignoring the response-body

  • Connection #0 to host api.sdkman.io left intact

  • Issue another request to this URL: 'https://corretto.aws/downloads/resources/21.0.5.11.1/amazon-corretto-21.0.5.11.1-macosx-x64.tar.gz'

  • Host corretto.aws:443 was resolved.

  • Connected to corretto.aws (52.85.213.16) port 443
    GET /downloads/resources/21.0.5.11.1/amazon-corretto-21.0.5.11.1-macosx-x64.tar.gz HTTP/1.1
    Host: corretto.aws
    User-Agent: curl/8.7.1
    Accept: /

  • Request completely sent off
    <
    { [15473 bytes data]
    ################################################################################################## 100.0%

  • Connection # 1 to host corretto.aws left intact

Downloaded binary to: DSV/sdkman/tmp/java-21.0.5-amzn.bin (HTTP headers written to: DSV/sdkman/var/metadata/java-21.0.5-amzn.headers)
Get post-installation hook: https://api.sdkman.io/2/hooks/post/java/21.0.5-amzn/darwinx64
Copy remote post-installation hook: DSV/sdkman/tmp/hook_post_java_21.0.5-amzn.sh
A macOS 64bit post-install hook was found for Java 21.0.5-amzn-openjdk.

Repackaging Java 21.0.5-amzn...
mv: rename Home to DSV/sdkman/tmp/Java-21.0.5-amzn: No such file or directory
__sdkman_post_installation_hook:cd:17: no such file or directory: DSV/sdkman/tmp

zip error: Nothing to do! (try: zip -qyr DSV/sdkman/tmp/java-21.0.5-amzn.zip . -i Java-21.0.5-amzn)

Done repackaging...
Cleaning up residual files...
Processed binary as: DSV/sdkman/tmp/java-21.0.5-amzn.zip
Completed post-installation hook...
warning [DSV/sdkman/tmp/java-21.0.5-amzn.zip]: zipfile is empty

Stop! The archive was corrupt and has been removed! Please try installing again.

I tried the zip commad suggested as follows (substituted -q(uiet) by -v(erbose) :

~ $ zip -vyr DSV/sdkman/tmp/java-21.0.5-amzn.zip . -i Java-21.0.5-amzn
Scanning files .............
zip warning: zip file empty
total bytes=0, compressed=0 -> 0% savings

I can't find any solution in other issues or posts anywhere. Thank you in advance.

@BuckB
Copy link

BuckB commented Nov 13, 2024

Just as a side note: I have just uninstalled sdkman and reinstalled it using the default location (no "export SDKMAN_DIR") and it works this time. Installing java ran ok, no errors. So it seems the issue, at least in my situation, was with the custom directory.

Funny thing is that it was under my user dir, just like the default one, so there should be no issues with permissions.
I wonder if it has something to do with the SDKMAN_DIR somehow. Can you try and replicate installing sdkman under a different directory and running it, see if it works? I would love to keep my dev stuff organized. Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants