A standalone compiler, can be downloaded from here.
For Kotlin M3 and higher, you need to install IntelliJ IDEA 12.
Once you've installed that, you'll need the Kotlin IDEA Plugin.
A stable milestone version of Kotlin can be obtained from JetBrains' Plugin Repository.
In IDEA navigate to: Settings -> Plugins -> Browse Repositories
Select the Kotlin plugin and then Download and Install.
In IDEA navigate to: Preferences -> Plugins -> Browse Repositories. Enter
Then you should be able to select the Kotlin plugin and Download and Install. The repository above contains nightly builds published automatically.
Alternatively, you can download the nightly builds of the IDEA Plugin from our build server, look under "Artifacts".
Then navigate to Preferences -> Plugins -> Install plugin from disk...
- Now in IDEA you can select File -> New Project.
- Create a new project as usual with a src directory.
- Right click on src and select New -> Kotlin file
- Enter some name, say 'Foo'
- The IDE will prompt you at the top right of your editor to select the Kotlin Runtime
- You'll need to point the IDE to some download of the Kotlin runtime (see below)
- Enter some code like this
- Now thats done you should be able to right click on the Foo class and select Run
Please note that the root project at github is a Java based project for creating the compiler and IDEA plugin. It should not be opened in IDEA with the Kotlin plugin installed!
However the kotlin libraries project is all Kotlin code and used to create the standard library, tests and associated tools. That project opens fine in IDEA with Kotlin plugin installed. You just may have to specify which KotlinRuntime to choose.
The IDEA plugin already includes a Kotlin runtime. If you want to use Kotlin yourself from the command line or Ant you may need this too (unless you use other build tools like the Kotlin Maven Plugin).
Download it from our build server (login as Guest, look under "Artifacts"):
- http://teamcity.jetbrains.com/viewType.html?tab=buildTypeStatusDiv&buildTypeId=bt345&guest=1 - IntelliJ IDEA 11
- http://teamcity.jetbrains.com/viewType.html?buildTypeId=bt389&guest=1 - IntelliJ IDEA 12 EAPs
Sometimes you open a Kotlin file and things go all red. This may mean that the IDEA plugin cannot find your Kotlin Runtime.
- Go to File -> Project Structure...
- Select Libraries tab
- Do you see KotlinRuntime? Is it pointing to a valid kotlin-runtime.jar?
- If not remove it and add a new one