{"id":12859,"date":"2021-12-16T08:13:18","date_gmt":"2021-12-16T08:13:18","guid":{"rendered":"https:\/\/linuxways.net\/?p=12859"},"modified":"2021-12-16T08:13:18","modified_gmt":"2021-12-16T08:13:18","slug":"install-kotlin-on-linux-mint-20","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/mint\/install-kotlin-on-linux-mint-20\/","title":{"rendered":"Install Kotlin on Linux Mint 20"},"content":{"rendered":"<h2>Introduction:<\/h2>\n<p>Kotlin is a statically typed programming language that came into being in 2011. It is a programming language that can be used for general purposes and is also capable of working along with Java. Moreover, this programming language can work across different operating systems. As far as this particular guide is concerned, then we will try to explain to you the procedure of installing Kotlin on a Linux Mint 20 system.<\/p>\n<h2>Installation of Kotlin on Linux Mint 20:<\/h2>\n<p>For installing the Kotlin programming language on a Linux Mint 20 system, we will perform the following steps. Moreover, this installation will be followed by creating and running a sample Kotlin script as well for testing its successful installation.<\/p>\n<h3>Step # 1: Install Kotlin on Linux Mint 20:<\/h3>\n<p>First, we will install Kotlin on Linux Mint 20 by running the command given below:<\/p>\n<pre><strong>$ sudo snap install kotlin --classic<\/strong><\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"520\" height=\"25\" class=\"wp-image-12860\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-159.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-159.png 520w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-159-300x14.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-159-501x25.png 501w\" sizes=\"auto, (max-width: 520px) 100vw, 520px\" \/><\/strong><\/p>\n<p>The installation of the Kotlin programming language will terminate with the following message:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"566\" height=\"77\" class=\"wp-image-12861\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-160.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-160.png 566w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-160-300x41.png 300w\" sizes=\"auto, (max-width: 566px) 100vw, 566px\" \/><\/p>\n<h3>Step # 2: Create a Sample Kotlin File:<\/h3>\n<p>Now, to test our installation, we will attempt to create a sample Kotlin file with the command shown below:<\/p>\n<pre><strong>$ sudo nano sample.kt<\/strong><\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"404\" height=\"25\" class=\"wp-image-12862\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-161.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-161.png 404w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-161-300x19.png 300w\" sizes=\"auto, (max-width: 404px) 100vw, 404px\" \/><\/strong><\/p>\n<p>Here, you need to know that all the Kotlin files have the \u201c.kt\u201d extension.<\/p>\n<h3>Step # 3: Write a Basic Program in Kotlin:<\/h3>\n<p>When this Kotlin file will open up in the nano editor, we will write a basic \u201chello world\u201d program in it as shown in the following image. After that, we will save and close our Kotlin script for going back to our terminal.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"645\" height=\"149\" class=\"wp-image-12863\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-162.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-162.png 645w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-162-300x69.png 300w\" sizes=\"auto, (max-width: 645px) 100vw, 645px\" \/><\/p>\n<h3>Step # 4: Ensure the Presence of the Kotlin Compiler on Linux Mint 20:<\/h3>\n<p>Now, before compiling this Kotlin script, we need to make sure that the Kotlin compiler exists on our system. For that, we will run the command shown below:<\/p>\n<pre><strong>$ kotlinc<\/strong><\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"310\" height=\"23\" class=\"wp-image-12864\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-163.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-163.png 310w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-163-300x22.png 300w\" sizes=\"auto, (max-width: 310px) 100vw, 310px\" \/><\/strong><\/p>\n<p>The following output will indicate the presence of the Kotlin compiler on our Linux Mint 20 system:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"645\" height=\"124\" class=\"wp-image-12865\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-164.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-164.png 645w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-164-300x58.png 300w\" sizes=\"auto, (max-width: 645px) 100vw, 645px\" \/><\/p>\n<h3>Step # 5: Compile the Kotlin Program:<\/h3>\n<p>We will simply type \u201c:quit\u201d and press the Enter key for exiting from the Kotlin compiler\u2019s interface. After that, we will run the command shown below in our terminal for compiling our Kotlin script:<\/p>\n<pre><strong>$ kotlinc sample.kt<\/strong><\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"388\" height=\"23\" class=\"wp-image-12866\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-165.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-165.png 388w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-165-300x18.png 300w\" sizes=\"auto, (max-width: 388px) 100vw, 388px\" \/><\/strong><\/p>\n<h3>Step # 6: Run the Kotlin Program:<\/h3>\n<p>Whenever a Kotlin script is being compiled, it is renamed by capitalizing the first alphabet of that file\u2019s name as well as the \u201ck\u201d of the extension. Also, the \u201c.\u201d in the name is removed in the compiled file\u2019s name. For example, the name of our Kotlin script file was \u201csample.kt\u201d which after compilation became \u201cSampleKt\u201d. Now, we will execute this compiled script with the following command:<\/p>\n<pre><strong>$ kotlin SampleKt<\/strong><\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"369\" height=\"23\" class=\"wp-image-12867\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-166.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-166.png 369w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-166-300x19.png 300w\" sizes=\"auto, (max-width: 369px) 100vw, 369px\" \/><\/strong><\/p>\n<p>The output of our Kotlin script is shown in the image below:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"644\" height=\"108\" class=\"wp-image-12868\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-167.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-167.png 644w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-167-300x50.png 300w\" sizes=\"auto, (max-width: 644px) 100vw, 644px\" \/><\/p>\n<h2>Removal of Kotlin from Linux Mint 20:<\/h2>\n<p>For removing the Kotlin programming language from a Linux Mint 20 system, you need to execute the following command:<\/p>\n<pre><strong>$ sudo snap remove kotlin<\/strong><\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"432\" height=\"22\" class=\"wp-image-12869\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-168.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-168.png 432w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-168-300x15.png 300w\" sizes=\"auto, (max-width: 432px) 100vw, 432px\" \/><\/strong><\/p>\n<h2>Conclusion:<\/h2>\n<p>With the help of this quick tutorial, you will be able to install Kotlin and get started with it on a Linux Mint 20 system very easily. Moreover, once you do not need this programming language any longer, then you can even remove it from your system very conveniently.<\/p>","protected":false},"excerpt":{"rendered":"<p>Introduction: Kotlin is a statically typed programming language that came into being in 2011. It is a programming language that can be used for general purposes and is&hellip;<\/p>","protected":false},"author":1,"featured_media":13018,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[751,129],"class_list":["post-12859","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-mint","tag-kotlin","tag-linux-mint-20"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/12859","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=12859"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/12859\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/13018"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=12859"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=12859"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=12859"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}