shyiko / jabba

(cross-platform) Java Version Manager
3.02k stars 198 forks source link

Cannot install any Java version #830

Open Quinten0508 opened 2 years ago

Quinten0508 commented 2 years ago

Running Windows 11, PS 5.1 Every time I use jabba install <version> it gives me this error:

Invoke-Expression : At line:1 char:1534
+ ... calCache\local-packages\Python39\Scripts;"C:\WINDOWS\System32;C:\WIND ...
+                                               ~~~~~~~~~~~~~~~~~~~
Unexpected token 'C:\WINDOWS\System32' in expression or statement.
At C:\Users\Quint\.jabba\jabba.ps1:11 char:40
+ ...        if (-not $expression -eq "") { Invoke-Expression $expression }
+                                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ParserError: (:) [Invoke-Expression], ParseException
    + FullyQualifiedErrorId : UnexpectedToken,Microsoft.PowerShell.Commands.InvokeExpressionCommand

However, using jabba ls does list the newly installed java version. jabba current returns nothing, thus I tried jabba use <version>, but this gave the same error as jabba install above:

Invoke-Expression : At line:1 char:1534
+ ... calCache\local-packages\Python39\Scripts;"C:\WINDOWS\System32;C:\WIND ...
+                                               ~~~~~~~~~~~~~~~~~~~
Unexpected token 'C:\WINDOWS\System32' in expression or statement.
At C:\Users\Quint\.jabba\jabba.ps1:11 char:40
+ ...        if (-not $expression -eq "") { Invoke-Expression $expression }
+                                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ParserError: (:) [Invoke-Expression], ParseException
    + FullyQualifiedErrorId : UnexpectedToken,Microsoft.PowerShell.Commands.InvokeExpressionCommand

I already had Java openjdk 1.8.0_292 installed prior to installing jabba, but when using jabba current or jabba ls this does not show up and instead returns nothing. I've tried running the PS window with administrator.

sytolk commented 2 years ago

for me jdk is installed but cannot use it on Windows 11

C:\Windows\system32>jabba use openjdk@1.16.0

C:\Windows\system32>java -version
'java' is not recognized as an internal or external command,
operable program or batch file.

C:\Windows\system32>jabba current

C:\Windows\system32>jabba ls
openjdk@1.16.0

C:\Windows\system32>
arbaleast commented 2 years ago

I have encountered the same problem, even if I restart PowerShell in Windows11


❯ jabba ls
liberica@1.16.0
liberica@1.8.292-10
❯ jabba use liberica@1.16.0
❯ java --version
java: The term 'java' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
arbaleast commented 2 years ago

❯ $psversiontable                                                                                                                                       Name                           Value
----                           -----
PSVersion                      7.2.6
PSEdition                      Core
GitCommitId                    7.2.6
OS                             Microsoft Windows 10.0.22621
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0