Jabba-Team / jabba

(cross-platform) Java Version Manager
Apache License 2.0
140 stars 11 forks source link

Fix scoop version #48

Open JanHuege opened 2 months ago

JanHuege commented 2 months ago

Installing via scoop on windows 11:

use and current do not have any effect. Downloading jdks works but is useless without the version manager functionality.

patrick-mccourt commented 1 month ago

Hi Jan,

Thanks for your patience while I've looked into this, the issue seems to be down to how scoop installs jabba. Scoop grabs the binary from the github releases and places it in the relevant directory.

This misses one step from our install script which activates the shell integration.

I have had an issue raised to look at the install process and making it a little better and haven't had the time. Package managers like scoop won't want a scripted install in so I need to come up with another way of setting up jabba to ensure the install works.

In the mean time, I can suggest you could do 1 of 2 things:

  1. Uninstall the scoop version and use the powershell script in this repo

or 2: Keep your scoop install and do this step manually:

Create a jabba.ps1 file in :

C:\Users\patri\scoop\apps\jabba\current\ with the contents:

$env:JABBA_HOME="C:\Users\$YOUR_USERNAME\scoop\apps\jabba\current"

function jabba
{
    $fd3=$([System.IO.Path]::GetTempFileName())
    $command="& 'C:\Users\$YOUR_USERNAME\scoop\apps\jabba\current\bin\jabba.exe' $args --fd3 `"$fd3`""
    & { $env:JABBA_SHELL_INTEGRATION="ON"; Invoke-Expression $command }
    $fd3content=$(Get-Content $fd3)
    if ($fd3content) {
        $expression=$fd3content.replace("export ","`$env:").replace("unset ","Remove-Item env:") -join "`n"
        if (-not $expression -eq "") { Invoke-Expression $expression }
    }
    Remove-Item -Force $fd3
}

Add in to your powershell profile:

if (Test-Path "C:\Users\$YOUR_USERNAME\scoop\apps\jabba\current\jabba.ps1") { . "C:\Users\$YOUR_USERNAME\scoop\apps\jabba\current\jabba.ps1" }

That should get you most of the jabba functionality (minus the default issue in your other issue)

Baneeishaque commented 1 month ago

i come with this solution - https://github.com/Baneeishaque/Scoop-Apps/blob/master/bucket/jabba.json. i don't know it is the best approach. i am open for suggestions.