In addition to Kotlin Web Demo, a web-based environment for editing, running and sharing Kotlin programs, we’ve opened access to snapshot builds and source code (under the Apache 2 License) of the following:
- The Kompiler — Kotlin compiler,
- Enhancements to basic Java libraries — convenient utilities for JDK collections and more,
- Build tools — Ant and Maven integration, and
- IntelliJ IDEA plugin — Kotlin’s native IDE.
We invite you to try Kotlin and give us your feedback, ideas and suggestions. Solve problems proposed on Web Demo and share your solutions with the world.
We are also looking for Kontributors, i.e. Kotlin contributors — brave souls eager to make this world a better place together with us. All Kontributions, from compiler to IDE patches to libraries and examples, are welcome and appreciated. You can start by reading our issue tracker or by just picking your favorite library and making it Kotlin-friendly.
Read more on http://jetbrains.com/kotlin
Our issue tracker: http://youtrack.jetbrains.com/issues/KT
The source code is available at http://github.com/JetBrains/Kotlin
Note that Kotlin is still under development. You can download snapshot builds here: https://github.com/JetBrains/Kotlin/downloads.
Attention: Latest builds of IntelliJ IDEA are required for running the plugin.
Congratulations on releasing Kotlin! I’ve downloaded kotlin-plugin-0.1.1358.zip and installed it in IntelliJ IDEA 11.0.2 build IC-111.277, but there is no mention of Kotlin that I can find anywhere in the new project/module dialogs or project/module settings. How can I create a new Kotlin project?
You don’t need to. Create a normal Java project, and as you add a Kotlin file to it, the IDE will propose you to set up the libraries. That’s it.
Check out the video on the home page: http://jetbrains.com/kotlin, there is all the process step-by-step
Note that the plugin will not work correctly with IntelliJ IDEA 11.0.2. You need to use the latest EAP build of IntelliJ IDEA 11.1: http://confluence.jetbrains.net/display/IDEADEV/IDEA+11.1+EAP
I’ve successfully added a Kotlin file now.
Thanks to both of you.
Kongratulations!
This is great news, but please do not adopt the habit of prefixing/starting words with a K (Kompiler, Kontributors). This has proven to be annoying by the Linux desktop project KDE (same with J* for Java and G* for GNU projects).
Really amazing stuff, seems to work quite well so far.
There’s a problem with the kotlin plugin that everyone will face immediately when opening the example projects in IDEA: The kotlin runtime is set up with the JAR file
kotlin-0.1.429\dist\kotlinc\lib\kotlin-runtime.jar
That directory does not exist, after changing it to
kotlin-0.1.429\kotlinc\lib\kotlin-runtime.jar
it works correctly.
Thanks, we’ll fix it soon
Is there an update site XML for the kotlin plugin at all?
Currently, there isn’t. We will set one up at some point, of course.
Exactly where do I set this??
Nevermind. Found it at bottom of guice-kotlin.jpr. It appears to have compiled and run correctly.
Kool!
Indeed! Thanks
What a nice Valentine’s Day present! Thanks, and congrats!
Agreed. I’m feeling the love!
Is there any tutorial, how compile something simple like
fun add(x: Int, y: Int): Int{ return x + y; }
to javascript
function add(x,y) {return x + y;}
?
Sorry, JavaScript is currently only supported on the Web Demo:
http://kotlin-demo.jetbrains.com
Is there any forum or community there I can ask some questions about kotlin?
A forum is being set up at http://devnet.jetbrains.net/community/kotlin
We haven’t migrated to it from our internal resources yet, but this is on the way.
pairless with one access only?
The hint states “there’s a solution that looks at each element only once and uses no data structures like collections or trees.”
This is a fact I doubt. If the array is not sorted, I have to search for each “partner”. Technically, “contains()” is also touching elements inside the array.
This is my shortest solution – any hints or clarifications to the comment?
fun findPairless(a : IntArray) : Int {
a.sort()
for(i in 0..(a.size/2)-1)
if(a[2*i] != a[2*i+1]) return a[2*i]
return a[a.size-1]
}
I can email you a solution that reads every element only once, if you like
Ofigenno!
And is there a planned date for the 1.0 release?
Not really, the design is being settled, and it’s hard to predict how much work will all the changes take.
You mention Maven. What does that mean here, exactly? Can I use Kotlin in my Maven-based Java projects right now?
Hi,
Yes, in a couple of days. Kotlin-Maven-plugin is ready and will be published this week together with Ant task and Gradle plugin.
Mmmm… Kotlin Gradle plugin. Me wants!
Sorry, it was a mistake in the announcement: the Gradle support is coming really soon, but it’s not done yet.
Once the maven plugin is setup, will you also be maintaining a maven repository for the plugin? Maybe talk to Sonatype and setup an oss.sonatype.org or repository and start strong with maven central support.
Out public TeamCity server provides an Ivy repository that can be used by Maven.
We’ll consider having something like an oss.sonatype.org as well.
Please, see the Kotlin Build Tools page for details about compiling Kotlin with Ant and Maven. As Andrey mentioned, Gradle plugin will be released very soon.
Congrats! Looking forward to try it out.
I have not used the IDE before. I tried to install the Kotlin plugin by using the “Install Plugin from Disk” option and pointing it to the Kotlin plugin zip file. I get “Fail to load plugin descriptor from file kotlin-0.1.429.zip” error. I am using the latest IU-114.98 IDE.
Download kotlin-plugin-0.1.1358.zip, not kotlin-0.1.429.zip (this is the standalone compiler).
Can’t seem to get it to set up the Kotlin runtime. If I click on the link, it just puts up a dialog box saying, ‘kotlin-runtime.jar’ is not found’. Where is the runtime supposed to go?
Message “Kotlin runtime library is not configured for module ‘guice-kotlin’”
When I click on the Setup Kotlin Runtime link, nothing happens.
You probably need to add the KotlinRuntime library to the project’s External Libraries list. Do this by opening the Project Structure dialogue and provide the path to kotlinc/lib.
Fixed!
Wrong version
I’m still not liking the ‘fun’ keyword though.
Ok, I give up. How do you make this work:
class Data(vararg elements: String) {
fun toString(): String = els.join(“,”)
var els:Array = elements.sort() // doesn’t work
}
Also tried Arrays.sort, Collections.sort, etc. Nothing works.
They return void instead of Array, so it shouldn’t work.
It seems that an extension for Array.sort() is missing in the standard library for now. Please, file a request about it, and feel free to contribute a fix.
Issue tracker: http://youtrack.jetbrains.com/issues/KT
GitHub: http://github.com/jetbrains/kotlin
I know, that Arrays.sort returns void. I also tried:
fun sort(v: ArrayList):ArrayList {
Collections.sort(v); // error
Collections.sort(v, {(a:String, b:String):Int -> a.compareTo(b) }); // error, too
return v;
}
inline fun <T: Comparable> Array.sort():Array {
Arrays.sort(this); // also an error
Arrays.sort(this, {(a:String, b:String):Int -> a.compareTo(b) }); // here too
return this;
}
The blog removed all angle brackets, so with []:
fun sort(v: ArrayList[String]):ArrayList[String] {
Collections.sort(v);
Collections.sort(v, {(a:String, b:String):Int -> a.compareTo(b) });
return v;
}
inline fun [T: Comparable[T]] Array[T].sort():Array[T] {
Arrays.sort(this);
Arrays.sort(this, {(a:String, b:String):Int -> a.compareTo(b) });
return this;
}
Waiting for IDEA 11.1……
Is there going to be a Kotlin mailing list or forum? At the moment it’s not clear where the best place is to post questions. There is this blog, Confluence and the bug tracker.
We’ll soon have a forum here:
http://devnet.jetbrains.net/community/kotlin
It’s being set up right now.
I registered an account for the forum. The Kotlin related three forums are grayed out when I want to post. Forum configuration issue?
Probably, we’ll look into it.
Does the module feature work in Kotlin? The documentation on modules is fairly sparse.
Thanks and congratulations! Can’t wait to use Kotlin for real.
Kotlin modules are in a toddler state now, but they are improving. And thanks for your interest and support!
Can you pattern match an array of strings? If so, how do you do it?
How can we build the stand-alone compiler? The Readme.md on Github only produces the plugin, and the build.xml does not include a target to pack up the stand-alone version of the compiler. I’d really like to fiddle around with Kotlin without having to run IntelliJ.
Actually, build.xml does not produce the plugin, it’s the compiler, as it is built here: http://teamcity.jetbrains.com/viewLog.html?buildId=60069&tab=artifacts&buildTypeId=bt344
Forum doesn’t seem to be up yet, so I’ll ask here.
Under ubuntu (IC-144.145) the plugin doesn’t seem to work. I get the following error when trying to compile an example:
“Cannot find kotlinc home. Make sure plugin is properly installed”
Plugin seems to be installed fine, can I edit the location of “kotlinc home” manually somewhere?
kotlinc must be coming together with the plugin. Could you file an issue to our tracker: http://youtrack.jetbrains.com/issues/KT ?
Thanks
My bad, I installed the plugin jar file found in the zip file. Installing the plugin from the zip file fixed my problems.
The forum should be fixed now.