Jabba -- Java JDK 版本管理工具


1.安裝

參照官網:https://github.com/shyiko/jabba

window 10:powershell下執行

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-Expression (
Invoke-WebRequest https://github.com/shyiko/jabba/raw/master/install.ps1 -UseBasicParsing
).Content

 

問題1:

Invoke-WebRequest : 未能解析此遠程名稱: 'raw.githubusercontent.com'
所在位置 行:2 字符: 3
+ Invoke-WebRequest https://github.com/shyiko/jabba/raw/master/instal ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest],WebExce
ption
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

解決:

1)打開IPAddress.com網站,輸入raw.githubusercontent.com,查詢出結果,如下:

Hostname Summary
Domain githubusercontent.com
IP Address
199.232.68.133
Web Server Location United States

2)在C:/Windows/System32/drivers/etc/hosts中添加

199.232.68.133 raw.githubusercontent.com

 

問題2:

. : File C:\Users\sanpingx\.jabba\jabba.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at
https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:79 char:3
+ . "$jabbaHome\jabba.ps1"
+ ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess

解決:

輸入Set-ExecutionPolicy -Scope CurrentUser,

等待提示信息ExecutionPolicy:,再輸入RemoteSigned,

最后輸入Y。

 

2.使用

常用命令可參照官網:https://github.com/shyiko/jabba

 

問題1:將系統中已安裝的JDK鏈接到jabba中

jabba link system@1.8.171 C:\Program Files\Java\jdk1.8.0_171
C:\Program\bin\java.exe wasn't found. If you believe this is an error - please create a ticket at https://github.com/shyiko/jabba/issues (specify OS and command that was used)

解決:由於路徑中有空格,將Program Files改為縮寫Progra~1

jabba link system@1.8.171 C:\Progra~1\Java\jdk1.8.0_171

 

問題2:將系統中已安裝的JDK鏈接到jabba中

jabba link system@1.8.171 C:\Progra~1\Java\jdk1.8.0_171
symlink C:\Progra~1\Java\jdk1.8.0_171 C:\Users\sanpingx\.jabba\jdk\system@1.8.171: A required privilege is not held by the client.

解決:權限不夠,以管理員身份運行power shell

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM