Failure to Compile – Day 90 of 100 Days…
Setting up my local environment took forever…and I got nowhere.
You can find more information in the video at the bottom of the page.
I’ve used the Kotlin Playground for practice the last couple months. It has a compiler which lets me test out different statements while I learn.
Recently I decided it was time to leave the nest. I would attempt to install the Kotlin compiler locally instead of using the Kotlin Playground.
I wanted to prepare my machine for when I start building apps using Kotlin. Installing the Kotlin compiler now would allow me to start creating files and compiling them locally. Not to mention the peace of mind knowing I would always have the most up-to-date version. I can manually update when a new version is released instead of confirming the version number on the Kotlin Playground website.
The Kotlin website features a full step-by-step guide for this on their website. While I followed the guide to the best of my ability, I still couldn’t quite finish the setup process.
I started out by downloading the compiler from the Kotlin Github page. After this, I unzipped it to my install location, copied the directory to it’s bin folder, and added it to my System Environment Variable.
I opened a Git Bash window, navigated to a recent project, and tested the compile command. Unfortunately, I got an error message saying the kotlinc command was not recognized (click below).
After this, I looked for different guides online. I figured the Kotlin tutorial may have left out one or two steps. What followed was a storm of various tweaks I thought might fix the issue.
I renamed the Kotlin folder, moved it, created an environment variable for the directory. Nothing worked! After careful review, I realized I made a small error.
Since I updated the environment variables for Windows, I was supposed to compile the kotlin files using the Windows Terminal! Git Bash has a separate Bash profile for setting up keywords and new commands. In other words, I was using the wrong terminal the entire time!
I opened a terminal window, ready to finally get things started! I navigated to my project, input the kotlinc command and…I was met with a series of long downloads that went on for over half an hour (click below).
I ended up canceling the download. At this point, I was too exhausted and I’d been at the computer for almost two hours with little to no progress. At least, it one area.
Despite these setbacks, I learned how to edit my environment variables. I also learned to only update local variables instead of system variables.
My account is the only one that needs access to the Kotlin compiler. This means I don’t need to update variables system wide to configure my environment. This is ideal for people on shared computers even if you don’t have administrative privileges.
I also learned NOT to configure my local environment during a livestream. There were constant interruptions to my internet speed while downloading dependencies for the compiler. This affected the quality of video multiple times throughout the livestream.
I’m shifting gears here. My next move is to set up the Kotlin compiler on my own. This way I can focus on the coding exercises during the next livestream. I’ll also prepare a tutorial for installing the Kotlin compiler and post it here as soon as it’s done.
Sources:
Install Kotlin Compiler