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

 

posted @ 2020-05-30 10:30  一年之旦  阅读(1372)  评论(0编辑  收藏  举报