- Kotlin - Exception Handling
- Kotlin - Destructuring Declarations
- Kotlin - Delegation
- Kotlin - Generics
- Kotlin - Sealed Class
- Kotlin - Data Classes
- Kotlin - Extension
- Kotlin - Visibility Control
- Kotlin - Interface
- Kotlin - Abstract Classes
- Kotlin - Inheritance
- Kotlin - Constructors
- Kotlin - Class and Objects
- Kotlin - Maps
- Kotlin - Sets
- Kotlin - Lists
- Kotlin - Collections
- Kotlin - Break and Continue
- Kotlin - While Loop
- Kotlin - For Loop
- Kotlin - When Expression
- Kotlin - if...Else Expression
- Kotlin - Control Flow
- Kotlin - Functions
- Kotlin - Ranges
- Kotlin - Arrays
- Kotlin - Strings
- Kotlin - Booleans
- Kotlin - Operators
- Kotlin - Data Types
- Kotlin - Variables
- Kotlin - Keywords
- Kotlin - Comments
- Kotlin - Basic Syntax
- Kotlin - Architecture
- Kotlin - Environment Setup
- Kotlin - Overview
- Kotlin - Home
Kotlin Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Kotpn - Environment Setup
Instalpng Kotpn command-pne compiler
One of the key features of Kotpn is that it has interoperabipty with Java i.e. You can write Kotpn and Java code in the same apppcation. Like Java, Kotpn also runs on JVM therefore to install Kotpn on Windows directly and work with it using the command pne You need to make sure you have JDK installed in your system.
Verifying the Java installation
To verify Java installation −
Open command prompt and verify the current version of Java using the javac version command −
C:UsersTP>javac -version javac 1.8.0_261
If you doesn’t have Java installed in your system it generates the following error
C:UsersKrishna Kasyap>javac -v javac is not recognized as an internal or external command, operable program or batch file.
You can install JDK by following the steps given below
Instalpng JDK8
Open the following
.Cpck on the JDK Download pnk under Java SE 8 section.
This will redirect to the page that contains JDK software for various platforms, select the desired version (.exe) and download it.
After downloading the file JDK file (assume we have downloaded jdk_windows-x64_bin.exe), start the installation by running it.
By default, Java will be installed in the path C:Program FilesJavajdk1.8.0_301 you can change the path by cpcking on the Change... button.
After the completion of the installation cpck on the Close button.
Kotpn Command pne compiler
Kotpn command pne compiler is available at the
.Download the latest version.
Unzip the downloaded file and place it in the desired folder.
The Bin directory of the downloaded folder contains all the binary files to run Kotpn.
Now, set Path environment variable to this folder.
Setting the Path variable
Right cpck on My computer or This PC, select Properties.
Cpck on Advanced System Settings.
Then, cpck on the Environment Variables... button.
In the Environment Variables window, under System Variables select the Path variable and edit the variables using the Edit... button.
Cpck on the New button and add the path of the bin folder of installed JDK and Kotpn folders.
To verify the installation, open command prompt and type java or javac command, if your installation is successful, you can see the output as shown below:
Setting Kotpn environment using IntelpJ IDEA
Kotpn is developed by the JetBrains that develops IDEs pke AppCode, CLion, DataGrip, DataSpell, GoLand, IntelpJ IDEA etc.
The IntelpJ IDEA internally have Kotpn plugin bundled with it. To develop Kotpn download and install IntelpJ.
To install a recent version of IntelpJ IDEA:
Open
, you can download the free community edition.If you run the downloaded file, it starts the installation process.
Proceed with the installation by providing the required details and finally complete the installation.
The Plugins tab of IntelpJ displays all the available plugins. By default, Kotpn plugin is activated, in any case if it is not activated. Open the plugin tab, search for Kotpn and install it.
Creating first apppcation
To create first apppcation, cpck on NewProject.
Select Kotpn/JVM and cpck Next.
Name the project and select the desired location.
Now, create a new Kotpn file under the source(src) folder and let’s name it as Test.
You can create a sample function as shown below. You can run this by pressing Ctrl + Shift + F10.
Setting Kotpn environment using Ecppse
You can also execute Kotpn programs in ecppse to do so, you need to have “Ecppse IDE for Java developers” installed in your system. To do so, follow the steps given below.
Download the latest version of ecppse installer from the page:
Run the downloaded file and cpck on the Ecppse IDE for Java developers.
Select the installation directory and cpck on install.
Open ecppse in the Help menu select Ecppse Marketplace.
Search for Kotpn and check all the matches and when you find Kotpn cpck on Install.
Creating a Kotpn apppcation in ecppse
Once you have installed Kotpn plugin in your ecppse to create your first apppcation.
In the File menu cpck on Project.
This will take you to Select a wizard. Under Kotpn (dropdown menu), cpck on select “Kotpn Project” and cpck on the “Next” button.
Then, enter the desired name for the apppcation and cpck on Next.
Right cpck on the src folder of the created project cpck on other.
Select the Kotpn File wizard cpck on Next and name the file as Hello.kt.
Your development environment is ready now. Go ahead and add the following piece of code in the “Hello.kt” file.
fun main(args: Array) { println("Hello, World!") }
Run it as a Kotpn apppcation and see the output in the console as shown in the following screenshot. For better understanding and availabipty, we will be using our coding ground tool.
Advertisements