Trouble running helloworld using IntelliJ plugin


#1

Hi.  

I thought I followed Hadi’s blog

http://hadihariri.com/2012/02/17/the-kotlin-journey-part-i-getting-things-set-up/

to the letter in getting helloworld to run, but I’m having problems.  No matter what I do, I cannot seem to find the menu entry that shows “Run namespace” so I can run the app.

Here is my Kotlin file:

import java.util.ArrayList

fun main(args : ArrayList<String>) : Unit {
  print(“hello ${args[0]}”)
}

Attached is a screenshot showing my options when I bring up the menu in the editor.

I’m using EAP 114.145 11.1 and plugin version kotlin-plugin-0.1.1358.zip.

Can someone suggest what I may be doing wrong?  I’ve spent an hour trying to figure this out, but to no avail.

Thank you kindly.



hello-kotlin.png (85.4 KB)

#2

Try to declare some package at the beginning of source file, maybe it helps.


#3

Frostman wrote:

Try to declare some package at the beginning of source file, maybe it helps.

I tried this:

package foo

import java.util.ArrayList

fun main(args : ArrayList<String>) : Unit {
  print(“hello ${args[0]}”)
}

but it still produces no “Run namespace” in the popup.


#4

Hi!

Try using Array<String> instead of ArrayList<String>. :slight_smile:


#5

Oh, my.  That was it.  Thank you!

Chagrined,
Mark


#6

Incidentally, for those of you reading along now or later, to run this code from the command line, do

$  java -cp lib/kotlin-runtime.jar:out/production/kotlin-lab foo.namespace
hello