文档章节

sdkman管理Java软件多版本切换

JimmyNo1
 JimmyNo1
发布于 2018/09/08 21:45
字数 2395
阅读 49
收藏 1

sdkman管理Java软件多版本切换

sdkman(Software Development Kit Manager,简称SDKMAN)是用来方便的管理多个版本的开发环境的工具,提供简洁的命令列出支持的软件如:java maven spring scala等等,支持的软件还在逐步增加。sdkman支持安装在任意的UNIX Based系统平台 如:Mac OSX, Linux, Cygwin, Solaris, FreeBSD

为什么使用sdkman?sdkman大大简化了我们配置java环境,原来的下载jdk、安装、配置环境变量等等繁琐重复操作由一个命令代替,并且可以方便切换java的版本,除了java外sdkman还支持十几种与java相关的软件如maven,spring,scala等等……

sdkman唯一的不便之处就是网站频繁被墙,当然这不怪sdkman,学会翻墙是学习技术的第一道门槛 在实战课程里面有视频演示安装,感兴趣的同学可以查看Activiti6.0工作流引擎深度解析与实战

安装sdkman

curl -s "https://get.sdkman.io" | bash
source "$HOME/.sdkman/bin/sdkman-init.sh"
sdk version

查看支持的软件

sdk list
================================================================================
Available Candidates
================================================================================
q-quit                                  /-search down
j-down                                  ?-search up
k-up                                    h-help

--------------------------------------------------------------------------------
Ant (1.10.1)                                             https://ant.apache.org/

Apache Ant is a Java library and command-line tool whose mission is to drive
processes described in build files as targets and extension points dependent
upon each other. The main known usage of Ant is the build of Java applications.
Ant supplies a number of built-in tasks allowing to compile, assemble, test and
run Java applications. Ant can also be used effectively to build non Java
applications, for instance C or C++ applications. More generally, Ant can be
used to pilot any type of process which can be described in terms of targets and
tasks.

                                                               $ sdk install ant
--------------------------------------------------------------------------------
AsciidoctorJ (1.5.7)                                     http://asciidoctor.org/

AsciidoctorJ is the official library for running Asciidoctor on the JVM. Using

================================================================================
Available Candidates
================================================================================
q-quit                                  /-search down
j-down                                  ?-search up
k-up                                    h-help

--------------------------------------------------------------------------------
Ant (1.10.1)                                             https://ant.apache.org/

Apache Ant is a Java library and command-line tool whose mission is to drive
processes described in build files as targets and extension points dependent
upon each other. The main known usage of Ant is the build of Java applications.
Ant supplies a number of built-in tasks allowing to compile, assemble, test and
run Java applications. Ant can also be used effectively to build non Java
applications, for instance C or C++ applications. More generally, Ant can be
used to pilot any type of process which can be described in terms of targets and
tasks.

                                                               $ sdk install ant
--------------------------------------------------------------------------------
AsciidoctorJ (1.5.7)                                     http://asciidoctor.org/

AsciidoctorJ is the official library for running Asciidoctor on the JVM. Using
AsciidoctorJ, you can convert AsciiDoc content or analyze the structure of a
parsed AsciiDoc document from Java and other JVM languages.

                                                      $ sdk install asciidoctorj
--------------------------------------------------------------------------------
Bpipe (0.9.9.6)                                                 http://bpipe.org

Bpipe is a framework for running computational pipelines and workflows

                                                             $ sdk install bpipe
--------------------------------------------------------------------------------
Ceylon (1.3.3)                                           http://ceylon-lang.org/

Ceylon is a modern, modular, statically typed programming language for the Java
and JavaScript virtual machines. The language features a flexible and very
readable syntax, a unique and uncommonly elegant static type system, a powerful
module architecture, and excellent tooling.

                                                            $ sdk install ceylon
--------------------------------------------------------------------------------
CRaSH (1.3.0)                                            http://www.crashub.org/

The Common Reusable SHell (CRaSH) deploys in a Java runtime and provides
interactions with the JVM. Commands are written in Groovy or Java and can be
developed at runtime making the extension of the shell very easy with fast
development cycle.

                                                             $ sdk install crash
--------------------------------------------------------------------------------
CUBA CLI (1.0.1)                                       https://cuba-platform.com

CUBA CLI is an open source command line utility that enables you to easily
create projects based on CUBA Platform

                                                              $ sdk install cuba
--------------------------------------------------------------------------------
CXF (3.2.5)                                              https://cxf.apache.org/

     1.0.0-rc5-graal

================================================================================
Available Candidates
================================================================================
q-quit                                  /-search down
j-down                                  ?-search up
k-up                                    h-help

--------------------------------------------------------------------------------
Ant (1.10.1)                                             https://ant.apache.org/

Apache Ant is a Java library and command-line tool whose mission is to drive
processes described in build files as targets and extension points dependent
upon each other. The main known usage of Ant is the build of Java applications.
Ant supplies a number of built-in tasks allowing to compile, assemble, test and
run Java applications. Ant can also be used effectively to build non Java
applications, for instance C or C++ applications. More generally, Ant can be
used to pilot any type of process which can be described in terms of targets and
tasks.

                                                               $ sdk install ant
--------------------------------------------------------------------------------
AsciidoctorJ (1.5.7)                                     http://asciidoctor.org/

AsciidoctorJ is the official library for running Asciidoctor on the JVM. Using
AsciidoctorJ, you can convert AsciiDoc content or analyze the structure of a
parsed AsciiDoc document from Java and other JVM languages.

                                                      $ sdk install asciidoctorj
--------------------------------------------------------------------------------
Bpipe (0.9.9.6)                                                 http://bpipe.org

Bpipe is a framework for running computational pipelines and workflows

                                                             $ sdk install bpipe
--------------------------------------------------------------------------------
Ceylon (1.3.3)                                           http://ceylon-lang.org/

Ceylon is a modern, modular, statically typed programming language for the Java
and JavaScript virtual machines. The language features a flexible and very
readable syntax, a unique and uncommonly elegant static type system, a powerful
module architecture, and excellent tooling.

                                                            $ sdk install ceylon
--------------------------------------------------------------------------------
CRaSH (1.3.0)                                            http://www.crashub.org/

The Common Reusable SHell (CRaSH) deploys in a Java runtime and provides
interactions with the JVM. Commands are written in Groovy or Java and can be
developed at runtime making the extension of the shell very easy with fast
development cycle.

                                                             $ sdk install crash
--------------------------------------------------------------------------------
CUBA CLI (1.0.1)                                       https://cuba-platform.com

CUBA CLI is an open source command line utility that enables you to easily
create projects based on CUBA Platform

                                                              $ sdk install cuba
--------------------------------------------------------------------------------
CXF (3.2.5)                                              https://cxf.apache.org/

Apache CXF is an open source services framework. CXF helps you build and develop
services using frontend programming APIs, like JAX-WS and JAX-RS. These services
can speak a variety of protocols such as SOAP, XML/HTTP, RESTful HTTP, or CORBA
and work over a variety of transports such as HTTP, JMS or JBI.

                                                               $ sdk install cxf
--------------------------------------------------------------------------------
Gaiden (1.1)                                       http://kobo.github.io/gaiden/

Gaiden is a tool that makes it easy to create documentation with Markdown.

                                                            $ sdk install gaiden
--------------------------------------------------------------------------------
Glide (0.9.2)                                      http://glide-gae.appspot.com/

Glide makes it incredibly easy to develop apps that harness the power of Google
App Engine for Java using expressiveness of Groovy and sweetness of Gaelyk s
syntactic sugar.

                                                             $ sdk install glide
--------------------------------------------------------------------------------
Gradle (4.10)                                                 http://gradle.org/

Gradle is a build automation tool that builds upon the concepts of Apache Ant
and Apache Maven and introduces a Groovy-based domain-specific language (DSL)
instead of the more traditional XML form of declaring the project configuration.
Gradle uses a directed acyclic graph (DAG) to determine the order in which tasks
can be run.

                                                            $ sdk install gradle
--------------------------------------------------------------------------------
Grails (3.3.8)                                               https://grails.org/

Grails is a powerful web framework, for the Java platform aimed at multiplying
developers productivity thanks to a Convention-over-Configuration, sensible
defaults and opinionated APIs. It integrates smoothly with the JVM, allowing you
to be immediately productive whilst providing powerful features, including
integrated ORM, Domain-Specific Languages, runtime and compile-time
meta-programming and Asynchronous programming.

                                                            $ sdk install grails
--------------------------------------------------------------------------------
Groovy (2.5.2)                                       http://www.groovy-lang.org/

Groovy is a powerful, optionally typed and dynamic language, with static-typing
and static compilation capabilities, for the Java platform aimed at multiplying
developers' productivity thanks to a concise, familiar and easy to learn syntax.
It integrates smoothly with any Java program, and immediately delivers to your
application powerful features, including scripting capabilities, Domain-Specific
Language authoring, runtime and compile-time meta-programming and functional
programming.

                                                            $ sdk install groovy
--------------------------------------------------------------------------------
GroovyServ (1.2.0)                            https://kobo.github.io/groovyserv/

GroovyServ reduces startup time of the JVM for runnning Groovy significantly. It
depends on your environments, but in most cases, it’s 10 to 20 times faster than
regular Groovy.

                                                        $ sdk install groovyserv
--------------------------------------------------------------------------------
Infrastructor (0.2.1)                                   http://infrastructor.io/

Infrastructor is an open source server provisioning tool written in Groovy

                                                     $ sdk install infrastructor
--------------------------------------------------------------------------------
Java (8.0.181-zulu)                                            https://zulu.org/

Java Platform, Standard Edition (or Java SE) is a widely used platform for
development and deployment of portable code for desktop and server environments.
Java SE uses the object-oriented Java programming language. It is part of the
Java software-platform family. Java SE defines a wide range of general-purpose
APIs – such as Java APIs for the Java Class Library – and also includes the Java
Language Specification and the Java Virtual Machine Specification.

                                                              $ sdk install java
--------------------------------------------------------------------------------
JBake (2.6.1)                                                  http://jbake.org/

JBake is a Java based, open source, static site/blog generator for developers
and designers.

                                                             $ sdk install jbake
--------------------------------------------------------------------------------
Kotlin (1.2.61)                                          https://kotlinlang.org/

Kotlin is a statically-typed programming language that runs on the Java Virtual
Machine and can also be compiled to JavaScript source code.

                                                            $ sdk install kotlin
--------------------------------------------------------------------------------
kscript (2.4.5)                          https://github.com/holgerbrandl/kscript

Enhanced scripting support for Kotlin on *nix-based systems. kscript provides an
easy-to-use, very flexible, and almost zero-overhead solution to write
self-contained mini-applications with Kotlin.

                                                           $ sdk install kscript
--------------------------------------------------------------------------------
Lazybones (0.8.3)                        https://github.com/pledbrook/lazybones/

Lazybones allows you to create a new project structure for any framework or
library for which the tool has a template.

                                                         $ sdk install lazybones
--------------------------------------------------------------------------------
Leiningen (2.7.1)                                          http://leiningen.org/

Leiningen is the easiest way to use Clojure. With a focus on project automation
and declarative configuration, it gets out of your way and lets you focus on
your code.

                                                         $ sdk install leiningen
--------------------------------------------------------------------------------
Maven (3.5.4)                                          https://maven.apache.org/

Apache Maven is a software project management and comprehension tool. Based on
the concept of a project object model (POM), Maven can manage a project's build,
reporting and documentation from a central piece of information.

                                                             $ sdk install maven
--------------------------------------------------------------------------------
Micronaut (1.0.0.M4)                                        http://micronaut.io/

Micronaut is an open source microservice framework for the JVM

                                                         $ sdk install micronaut
--------------------------------------------------------------------------------
sbt (1.2.1)                                            http://www.scala-sbt.org/

SBT is an open source build tool for Scala and Java projects, similar to Java's
Maven or Ant. Its main features are: native support for compiling Scala code and
integrating with many Scala test frameworks; build descriptions written in Scala
using a DSL; dependency management using Ivy (which supports Maven-format
repositories); continuous compilation, testing, and deployment; integration with
the Scala interpreter for rapid iteration and debugging; support for mixed
Java/Scala projects

                                                               $ sdk install sbt
--------------------------------------------------------------------------------
Scala (2.12.6)                                        http://www.scala-lang.org/

Scala is a programming language for general software applications. Scala has
full support for functional programming and a very strong static type system.
This allows programs written in Scala to be very concise and thus smaller in
size than other general-purpose programming languages. Scala source code is
intended to be compiled to Java bytecode, so that the resulting executable code
runs on a Java virtual machine. Java libraries may be used directly in Scala
code and vice versa. Scala is object-oriented, and uses a curly-brace syntax.
Scala has many features of functional programming languages, including currying,
type inference, immutability, lazy evaluation, and pattern matching. It also has
an advanced type system supporting algebraic data types, covariance and
contravariance, higher-order types, and anonymous types. Other features of Scala
include operator overloading, optional parameters, named parameters, raw
strings, and no checked exceptions.

                                                             $ sdk install scala
--------------------------------------------------------------------------------
Spark (2.3.1)                                          https://spark.apache.org/

Apache Spark is an open-source cluster-computing framework. Spark provides an
interface for programming entire clusters with implicit data parallelism and
fault-tolerance.

                                                             $ sdk install spark
--------------------------------------------------------------------------------
Spring Boot (2.0.4.RELEASE)               http://projects.spring.io/spring-boot/

Spring Boot takes an opinionated view of building production-ready Spring
applications. It favors convention over configuration and is designed to get you
up and running as quickly as possible.

                                                        $ sdk install springboot
--------------------------------------------------------------------------------
Sshoogr (0.9.25)                             https://github.com/aestasit/sshoogr

Sshoogr is a Groovy based DSL and command line tool for working with remote
servers through SSH.

                                                           $ sdk install sshoogr
--------------------------------------------------------------------------------
Vert.x (3.5.3)                                                  http://vertx.io/

Vert.x is a tool-kit for building reactive applications on the JVM.

                                                             $ sdk install vertx
--------------------------------------------------------------------------------
VisualVM (1.4.1)                                     https://visualvm.github.io/

VisualVM is a tool that provides a visual interface for viewing detailed
information about Java applications while they are running on a Java Virtual
Machine.

                                                          $ sdk install visualvm
--------------------------------------------------------------------------------

可以看到跟java相关的各种工具

基于sdkman安装java

我们列出sdkman支持的各种java版本,注意sdkman并不是支持所有的版本,最常用的java7,8,9都是支持的

 ~  sdk ls java
================================================================================
Available Java Versions
================================================================================
     12.ea.08-open
     11.ea.28-open
     10.0.2-zulu
     10.0.2-open
     10.0.2-oracle
     9.0.7-zulu
     9.0.4-open
   + 8u161-oracle
   + 8u152-zulu
   + 8u131-zulu
 > * 8.0.181-zulu
     8.0.181-oracle
   + 7u141-zulu
     7.0.181-zulu
     1.0.0-rc5-graal

================================================================================
+ - local version
* - installed
> - currently in use
================================================================================

安装指定的版本,如果不选择版本默认安装最新的版本

 ~  sdk install java 9.0.4-open
Downloading: java 9.0.4-open

In progress...

##                                                                         3.5%

临时使用java指定的版本 当前shell有效

~ sdk use java 8u161-oracle

Using java version 8u161-oracle in this shell.

切换java到指定版本 全局生效

~ sdk default java 8u161-oracle

Default java version set to 8u161-oracle

安装maven

安装maven最新版本,并设置为默认版本

~ sdk install maven

其它java相关软件一样如springboot

~ sdk install springboot

查看sdk安装的软件

 ~ sdk current
Using:

gradle: 4.10
groovy: 2.5.2
java: 8u161-oracle
jbake: 2.6.1
maven: 3.5.4
scala: 2.12.6
spark: 2.3.1
springboot: 2.0.4.RELEASE
visualvm: 1.4.1

后记

几个命令轻松安装java开发环境确实挺方便,java攻城狮再也不怕重装系统了 传送门 https://sdkman.io/ ps:网站经常不定期被墙

© 著作权归作者所有

JimmyNo1
粉丝 4
博文 1
码字总数 2395
作品 0
海淀
私信 提问
如何在同一台机器上安装多个版本的Java

如何在同一台机器上安装多个版本的Java 不久前,我写了一篇文章,Java Lambda表达式说明。对于我来说,使用Java 8探索这个概念很容易,因为它已经安装在我的项目中。但是在我目前的项目中,我...

白石
04/04
0
0
SDKMAN:轻松管理多个软件开发套件 (SDK) 的命令行工具

你是否是一个经常在不同的 SDK 下安装和测试应用的开发者?我有一个好消息要告诉你!给你介绍一下 SDKMAN,一个可以帮你轻松管理多个 SDK 的命令行工具。它为安装、切换、列出和移除 SDK 提供...

作者: Sk
2018/11/07
0
0
SDK管理利器——sdkman

项目使用java的开发者一定会为新配环境变量而头大,sdkman很好的解决了系统sdk管理的痛点,仅需简单的几行命令就可以完成sdk的安装,更改默认版本。再也不用担心环境变量的问题。 安装 既然是...

三也视界
02/13
0
0
MinGw install SDKMAN

mingw 安装 curl zip unzip curl 官网下载: https://curl.haxx.se/download.html https://curl.haxx.se/windows/dl-7.64.0/curl-7.64.0-win64-mingw.zip 解压后 curl-7.64.0-win64-mingw\bi......

dworry
02/28
0
0
Eclipse教程1 - 3分钟理清Maven依赖

作者: 韩勇 日期: 2018-12-02 前言 大学学习 Java 时开始接触 Eclipse,喜欢其强大和方便,并立志成为一名 Java 开发。然而近几年 Eclipse 的流行度开始下滑,一方面有 Eclipse 自身的不足(...

hyerty
2018/12/10
0
0

没有更多内容

加载失败,请刷新页面

加载更多

进程命令ps

命令ps 用途: 显示当前系统的进程状态 语法: ]# ps [选项] 常用选项: aux = 列出正在运行的所有进程; a 显示现行终端机下的所有程序,包括其他用户的程序 u 以用户为主...

迷失De挣扎
33分钟前
3
0
聊聊spring cloud的CachingSpringLoadBalancerFactory

序 本文主要研究一下spring cloud的CachingSpringLoadBalancerFactory CachingSpringLoadBalancerFactory spring-cloud-openfeign-core-2.2.0.M1-sources.jar!/org/springframework/cloud/o......

go4it
昨天
4
0
一篇文章搞定——JDK8中新增的StampedLock

一、StampedLock类简介 StampedLock类,在JDK1.8时引入,是对读写锁ReentrantReadWriteLock的增强,该类提供了一些功能,优化了读锁、写锁的访问,同时使读写锁之间可以互相转换,更细粒度控...

须臾之余
昨天
3
0
Android Camera原理之CameraDeviceCallbacks回调模块

在讲解《Android Camera原理之openCamera模块(二)》一文的时候提到了CameraDeviceCallbacks回调,当时没有详细展开,本文我们详细展开讲解一下。 CameraDeviceCallbacks生成过程: 《Android...

天王盖地虎626
昨天
3
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部