In my last blog I talked about exploring Kotlin, a JVM language in development by JetBrains. In this blog I’ll walk through a larger piece of Kotlin code.
The program we’re talking about is a simple spell checker. It reads a dictionary of words from a file (/usr/share/dict/words) into a set. Then it reads a sentence from stdin and checks if every word is in the dictionary. Finally it informs the user whether or not the sentence is spelled correctly, i.e. every word is known in the dictionary.
The spell checker is available on my GitHub. Take a moment to study the Java version, we’ll discuss the Kotlin version next.
I’ve been exploring Kotlin recently. Kotlin is a new statically typed JVM language and was announced about half a year ago. This month JetBrains released its first milestone candidate which I decided to have a closer look at.
First of Kotlin is still in its early stages. A lot of things work pretty well (I’m especially impressed by the IDE support) but there are still numerous issues. I’ve hit a couple of bugs so far.
Currently I’m using the build-in HTTP server in Java 6 for (integration) testing RESTful services. Although this has the advantage of adding zero dependencies, the API of REST-assured looks cleaner. Something to keep in mind when you need to test (many) services.
There’s an annoying issue when using Maven from IntelliJ IDEA on OSX. You might encounter the following error when building a Maven project.
No valid Maven installation found. Either set the home directory in the configuration dialog or set the M2_HOME environment variable on your system.
The issue is well known and there are various solutions to the problem. The trouble with some is they apply to old versions of OSX, specifically Leopard. If your running Snow Leopard or higher you don’t need to alter your launchd configuration. The following will suffice:
1) Check you Maven home directory.
2) Create the following file in ~/.MacOSX/environment.plist.
3) Make sure you enter the correct path as shown in the Maven version info.
4) Reboot your system (I know it’s annoying).
Now you should have no problem starting Maven builds from IDEA.