SDKMAN!关联已安装JDK

  • 查看已经安装的JDK目录
sh 复制代码
xxx:~ xxx$ /usr/libexec/java_home -V
Matching Java Virtual Machines (3):
    17.0.6, x86_64:	"Java SE 17.0.6"	/Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home
    11.0.10, x86_64:	"Java SE 11.0.10"	/Library/Java/JavaVirtualMachines/jdk-11.0.10.jdk/Contents/Home
    1.8.0_181, x86_64:	"Java SE 8"	/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home
  • 安装本地已经安装好的JDK命令如下
sh 复制代码
# 注意版本不要跟sdk list java中展示的重复,否则无法关联,并且环境变量配置要移除,否则不生效
sdk install java 17.0.6 /Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home
  • 本地已经安装好的JDK命令,左侧标记为Unclassified未经分类的JDK便是本地安装添加SDKMAN!管理的jdk,左侧有>>>标识当前默认版本
sh 复制代码
administrator:~ administrator$ sdk list java

               |     | 22.3.5.r11   | nik     |            | 22.3.5.r11-nik      
 Microsoft     |     | 21.0.4       | ms      |            | 21.0.4-ms           
               |     | 17.0.12      | ms      |            | 17.0.12-ms          
               |     | 11.0.24      | ms      |            | 11.0.24-ms          
 Oracle        |     | 22.0.2       | oracle  |            | 22.0.2-oracle       
               |     | 21.0.4       | oracle  |            | 21.0.4-oracle       
               |     | 17.0.12      | oracle  |            | 17.0.12-oracle      
 SapMachine    |     | 22.0.2       | sapmchn |            | 22.0.2-sapmchn      
               |     | 21.0.4       | sapmchn |            | 21.0.4-sapmchn      
               |     | 17.0.12      | sapmchn |            | 17.0.12-sapmchn     
               |     | 11.0.24      | sapmchn |            | 11.0.24-sapmchn     
 Semeru        |     | 21.0.4       | sem     |            | 21.0.4-sem          
               |     | 21.0.3       | sem     |            | 21.0.3-sem          
               |     | 17.0.12      | sem     |            | 17.0.12-sem         
               |     | 17.0.11      | sem     |            | 17.0.11-sem         
               |     | 11.0.24      | sem     |            | 11.0.24-sem         
               |     | 11.0.23      | sem     |            | 11.0.23-sem         
               |     | 8.0.422      | sem     |            | 8.0.422-sem         
               |     | 8.0.412      | sem     |            | 8.0.412-sem         
 Temurin       |     | 22.0.2       | tem     |            | 22.0.2-tem          
               |     | 21.0.4       | tem     |            | 21.0.4-tem          
               |     | 17.0.12      | tem     |            | 17.0.12-tem         
               |     | 11.0.24      | tem     |            | 11.0.24-tem         
               |     | 8.0.422      | tem     |            | 8.0.422-tem         
 Tencent       |     | 17.0.12      | kona    |            | 17.0.12-kona        
               |     | 11.0.24      | kona    |            | 11.0.24-kona        
               |     | 8.0.422      | kona    |            | 8.0.422-kona        
 Trava         |     | 11.0.15      | trava   |            | 11.0.15-trava       
               |     | 8.0.282      | trava   |            | 8.0.282-trava       
 Zulu          |     | 22.0.2.fx    | zulu    |            | 22.0.2.fx-zulu      
               |     | 22.0.2       | zulu    |            | 22.0.2-zulu         
               |     | 21.0.4.fx    | zulu    |            | 21.0.4.fx-zulu      
               |     | 21.0.4       | zulu    |            | 21.0.4-zulu         
               |     | 17.0.12.fx   | zulu    |            | 17.0.12.fx-zulu     
               |     | 17.0.12      | zulu    |            | 17.0.12-zulu        
               |     | 11.0.24.fx   | zulu    |            | 11.0.24.fx-zulu     
               |     | 11.0.24      | zulu    |            | 11.0.24-zulu        
               |     | 8.0.422.fx   | zulu    |            | 8.0.422.fx-zulu     
               |     | 8.0.422      | zulu    |            | 8.0.422-zulu        
               |     | 7.0.352      | zulu    |            | 7.0.352-zulu        
 Unclassified  |     | 17.0.6       | none    | local only | 17.0.6              
               |     | 11.0.10      | none    | local only | 11.0.10             
               | >>> | 1.8.0        | none    | local only | 1.8.0               
================================================================================
Omit Identifier to install default version 21.0.4-tem:
    $ sdk install java
Use TAB completion to discover available versions
    $ sdk install java [TAB]
Or install a specific version by Identifier:
    $ sdk install java 21.0.4-tem
Hit Q to exit this list view
================================================================================
  • 关联管理成功后就可以正常使用SDKMAN!管理
sh 复制代码
# 设置默认JDK版本
sdk default java 17.0.6
# 查看当前jdk版本
sdk current java

官方网站:https://sdkman.io/

开源SDK:https://github.com/mingyang66/spring-parent

相关推荐
ProtonBase27 分钟前
如何从 0 到 1 ,打造全新一代分布式数据架构
java·网络·数据库·数据仓库·分布式·云原生·架构
乐之者v33 分钟前
leetCode43.字符串相乘
java·数据结构·算法
suweijie7684 小时前
SpringCloudAlibaba | Sentinel从基础到进阶
java·大数据·sentinel
公贵买其鹿5 小时前
List深拷贝后,数据还是被串改
java
xlsw_8 小时前
java全栈day20--Web后端实战(Mybatis基础2)
java·开发语言·mybatis
神仙别闹9 小时前
基于java的改良版超级玛丽小游戏
java
黄油饼卷咖喱鸡就味增汤拌孜然羊肉炒饭9 小时前
SpringBoot如何实现缓存预热?
java·spring boot·spring·缓存·程序员
暮湫9 小时前
泛型(2)
java
超爱吃士力架9 小时前
邀请逻辑
java·linux·后端
南宫生9 小时前
力扣-图论-17【算法学习day.67】
java·学习·算法·leetcode·图论