DEV Community

Ajeeb.K.P
Ajeeb.K.P

Posted on

3 1

Kotlin programming language - First impression

Introduction

Kotlin is a language with multiple domain support like Mobile-Cross-platform, Native, Data Science, Server-side, Web-development and Android (As per their website).

Some personal rant

And I was told, it has got a set wonderful language features (I'm only aware avoidance of null pointer exceptions. But I'm not even sure about the seriousness of null pointer exception, even though, I had more than 3 years of production experience with C# - which is having null, so null pointer exception. Anyone really interested, do comment below).

Installation

Since, I'm a Linux user. SDK is the tool to install kotlin. I think. Even, I had done this before :-) . Again, I had multiple options here, I was using brew already (Yeah, brew works well with Linux for most of apps). Also, I'm using snapd (https://snapcraft.io/snapd).

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

Install kotlin
sdk install kotlin

Hello World :-)

fun main(args: Array<String>) {
    println("Hello, World!")
}
Enter fullscreen mode Exit fullscreen mode

Let's build this. Yeah, we build a .jar, which can be run through java

kotlinc hello.kt -include-runtime -d hello.jar

Simple build for class is, which produces HelloKt.class and a META-INF/ folder.
kotlinc hello.kt

Run it

Since, we did include the runtime. It just need a java installation. I tested by removing kotlin from env (If you are interested in it, in short it's a simple ~/.bashrc trick to avoid loading sdk path into .env).
java -jar hello.jar

This prints a hello world message as per source code above. Since, I was checking Neutralinojs, together, I was interested in size of .jar file. It's around 1MB only.

Reference

https://kotlinlang.org/docs/tutorials/command-line.html

Image of Datadog

How to Diagram Your Cloud Architecture

Cloud architecture diagrams provide critical visibility into the resources in your environment and how they’re connected. In our latest eBook, AWS Solution Architects Jason Mimick and James Wenzel walk through best practices on how to build effective and professional diagrams.

Download the Free eBook

Top comments (0)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay