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

相关推荐
Yeats_Liao11 分钟前
Spring 框架:配置缓存管理器、注解参数与过期时间
java·spring·缓存
Yeats_Liao11 分钟前
Spring 定时任务:@Scheduled 注解四大参数解析
android·java·spring
码明12 分钟前
SpringBoot整合ssm——图书管理系统
java·spring boot·spring
某风吾起16 分钟前
Linux 消息队列的使用方法
java·linux·运维
xiao-xiang19 分钟前
jenkins-k8s pod方式动态生成slave节点
java·kubernetes·jenkins
取址执行31 分钟前
Redis发布订阅
java·redis·bootstrap
S-X-S44 分钟前
集成Sleuth实现链路追踪
java·开发语言·链路追踪
快乐就好ya1 小时前
xxl-job分布式定时任务
java·分布式·spring cloud·springboot
沉默的煎蛋1 小时前
MyBatis 注解开发详解
java·数据库·mysql·算法·mybatis
Aqua Cheng.1 小时前
MarsCode青训营打卡Day10(2025年1月23日)|稀土掘金-147.寻找独一无二的糖葫芦串、119.游戏队友搜索
java·数据结构·算法