Skip to main content

Running Kotlin Program With CommanLine - windows

We can write kotlin programs in text editor and run the programs using command line. We need kotlin complier for this . we can download KOTLIN COMPILER FROM HERE . 


2. Unzip Kotlin compiler to program files in c drive
         

3. Copy the path of bin (C:\Program Files\kotlin\bin) and add it your to PATH in System variable.
  

If you do not know how to add path in system variable , you can use the following link

4. Now open notepad and write your kotlin program
fun main(args: Array<String>) {
    println("Hello World")
}
5. save the program as helloworld.kt , i have saved it to my Documents
6. Open cmd 

7. I have saved my helloworld.kt file in Documents folder , so i am changing my directory to Documents  (you have to change it to your directory where the file is saved)
               cd documents
8. Compile the kotlin program using the following command
               kotlinc helloword.kt -include-runtime -d helloworld.jar
9. Run the program using the following command
               java -jar helloworld.jar



Comments

Popular posts

Simple Calculator With ViewModel and LIveData

This is a simple calculator with basic mathematical operations. You can download full source code of this project from Github https://github.com/arunkfedex/SimpleCalculator We are using ViewModel and LiveData so we need to add those dependencies in build.gradle file. build.gradle plugins { id 'com.android.application' id 'kotlin-android' } android { compileSdk 30 defaultConfig { applicationId "com.arun.androidtutsforu.simplecalculator" minSdk 21 targetSdk 30 versionCode 1 versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 ta...

How to Open Android Emulator form Command Line and install Apk in Emulator

  You can also view this on my youtube channel How to Open Android Emulator from Commad Line 1.Open Command line 2.Change working directory to android sdk directory    cd  appdata/local/android/sdk/emulator 3.List all available Android virtual devices     emulator -list-avds 4. All your avds will be shown choose the avd_name you want to open    emulator -avd avd_name   5.Your Android virtual device will open up How to install APk file to emulator Drag the APK to Android emulator it will install automatically

Android List View using Custom Adapter and SQLite

following is a simple applicaton to create ListView using  Custom adapter.screenshot of the application  is like this . ListView is not used in android Anymore . We use  RecyclerView  and  CardView   in Android RecyclerView Demo is available on the following link http://androidtuts4u.blogspot.in/2017/04/android-recyclerview-example.html RecyclerView with Cardview Example is available on the following link http://androidtuts4u.blogspot.in/2017/09/android-card-view-example.html The ListView below the submit button is populated using Custom Adapter.Data is stored and retrieved using SQLite databsase. you can download the source code of this project from  google drive   https://drive.google.com/folderview?id=0BySLpWhqmbbdUXE5aTNhazludjQ&usp=sharing click on the above link ->sign into  your  google account ->add this to your google drive -> open it in google drive and download it. To create a simple ...