Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use SDKMAN in Linux

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to use SDKMAN in Linux. It is very detailed and has a certain reference value. Friends who are interested must finish it!

Install SDKMAN

Installing SDKMAN is easy. First, make sure you have zip and unzip installed. They are in the default repository of most Linux distributions.

For example, to install unzip on a Debian-based system, simply run:

$sudo apt-get install zip unzip

Then install SDKMAN using the following command:

$curl-s "https://get.sdkman.io" | bash

After the installation is complete, run the following command:

$source "$HOME/.sdkman/bin/sdkman-init.sh"

If you want to customize the installation to another location, such as / usr/local/, you can do this:

$export SDKMAN_DIR= "/ usr/local/sdkman" & & curl-s "https://get.sdkman.io" | bash

Make sure your users have sufficient permissions to access this directory.

* check using the following command after the installation is complete:

$sdk version==== BROADCAST = * 01Infrastructor 08 released on SDKMAN 18: Kotlin 1.2.60 released on SDKMAN! # kotlin* 31-07-18: Sbt 1.2.0 released on SDKMAN! # sbt* 31-07-18: Infrastructor 0.2.1 released on SDKMAN! # infrastructor==== SDKMAN 5.7.2 account 323

Congratulations! SDKMAN has been installed. Let's take a look at how to install and manage SDKs.

Manage multiple SDK

To view the list of available SDK, run:

$sdk list

Will output:

= Available Candidates====q-quit /-search downj-down?-search upk-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 driveprocesses described in build files as targets and extension points dependentupon 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 andrun Java applications. Ant can also be used effectively to build non Javaapplications, for instance C or C++ applications. More generally, Ant can beused to pilot any type of process which can be described in terms of targets andtasks. : $sdk install ant

As you can see, SDK lists one of the many SDK at a time, along with a description of the SDK, an official URL, and installation commands. Press enter to continue to the next one.

Install a new SDK, such as Java JDK, and run:

$sdk install java

Will output:

Downloading: java 8.0.172-zulu In progress... # 100.0% Repackaging Java 8.0.172 UV Zulu. Done repackaging... Installing: java 8.0.172-zuluDone installing! Setting java 8.0.172-zulu as default.

If you have more than one SDK installed, it will prompt you if you want to set the currently installed version as the default version. Answering Yes will set the current version as the default version.

Install another version of SDK using the following command:

$sdk install ant 1.10.1

If you have previously installed a SDK locally, you can set it to the local version as follows.

$sdk install groovy 3.0.0-SNAPSHOT / path/to/groovy-3.0.0-SNAPSHOT

List multiple versions of a SDK:

$sdk list ant

Will output:

= Available Ant Versions==== > * 1.10.11.10.01.9.91.9.81.9.7 = = +-local version*-installed >-currently in use====

As I said before, if you have more than one version installed, SDKMAN will prompt you if you want to set the currently installed version to the default version. You can answer Yes to set it as the default version. Of course, you can also set it later with the following command:

$sdk default ant 1.9.9

The above command will set Apache Ant 1.9.9 as the default version.

You can choose to use any installed version of SDK according to your needs, just run the following command:

$sdk use ant 1.9.9

Check the current version number of a specific SDK, such as Java, and run:

$sdk current javaUsing java version 8.0.172-zulu

Check all the SDK version numbers that are currently in use and run:

$sdk current Using: ant: 1.10.1java: 8.0.172-zulu

To upgrade outdated SDK, run:

$sdk upgrade scala

You can also check which of all SDK are obsolete.

$sdk upgrade

SDKMAN has offline mode, which allows SDKMAN to function properly when offline. You can turn offline mode on or off at any time using the following command:

$sdk offline enable$ sdk offline disable

To remove the installed SDK, run:

$sdk uninstall ant 1.9.9

For more details, see the help section.

$sdk help Usage: sdk [candidate] [version] sdk offline commands:install or I [version] uninstall or rm list or ls [candidate] use or u [version] default or d [version] current orc [candidate] upgrade or ug [candidate] version or vbroadcast or bhelp or hoffline [enable | disable] selfupdate [force] updateflush candidate: the SDK to install: groovy, scala, grails, gradle, kotlin, etc. Use list command for comprehensive list of candidates eg: $sdk list version: where optional Defaults to latest stable if not provided eg: $sdk install groovy update SDKMAN

If a new version is available, you can install it using the following command:

$sdk selfupdate

SDKMAN checks for updates regularly and gives you instructions on how to update them.

WARNING: SDKMAN is out-of-date and requires an update. $sdk updateAdding new candidates (s): scala clears the cache

It is recommended that you clean the cache from time to time (including those downloaded SDK binaries). Just run the following command:

$sdk flush archives

It can also be used to clean up empty folders to save a little space:

$sdk flush temp Uninstall SDKMAN

If you don't think you need or like SDKMAN, you can delete it using the following command.

$tar zcvf ~ / sdkman-backup_$ (date +% F-%kh%M). Tar.gz-C ~ / .sdkman $rm-rf ~ / .sdkman

* Open your .bashrc, .bash _ profile and / or .profile, find and delete the following lines.

# THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO worm exports export SDKMAN_DIR= "/ home/sk/.sdkman" [[- s "/ home/sk/.sdkman/bin/sdkman-init.sh"] & & source "/ home/sk/.sdkman/bin/sdkman-init.sh"

If you are using ZSH, delete the above line from .zshrc.

The above is all the contents of the article "how to use SDKMAN in Linux". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report