June 27, 2023

Kotlin - Installing the IDEA gui

After fooling around with Kotlin Native on Fedora for a few days, I decided to investigate the IDEA download. The community edition is free. I end up with the following file (presumably it figured out I was running linux):
ideaIC-2023.1.3.tar.gz
I copy this to /u1 and untar it, it untars to "idea-IC-231.9161.38". Inside this directory I find Install-Linux-tar.txt which has directions.

Inside of the bin directory is "idea.sh". You can cd to that directory and then invoke that script. What I decide to do is this:

cd /u1
ln -s idea-IC-231.9161.38 idea
cd idea/bin
ln -s idea.sh idea
Then I add /u1/idea/bin to my PATH by adding the following line to my .bashrc
export PATH=/u1/idea/bin:$PATH

Fire it up

I launch a new terminal window and type "idea".
It asks me to accept some terms (I do).
I agree to send anonymous statistics.
It launches a "Welcome to Intellij IDEA" screen.

I tell it to launch a new project. It detects I have version 20 of the JDK. I select the Kotlin language (Java, Groovy, and HTML are other choices). It will use the Intellij build system (Maven and Gradle are other choices). I leave the "Add sample code" box checked and click the "Create" button at the bottom of the screen.

Now I have Main.kt which has a slightly augmented version of the usual "hello world" demo.

It puts this in /home/tom/IdeaProjects as "untitled". I click on the usual right pointing green triangle to run (and build apparently) and get:

/usr/lib/jvm/java-20/bin/java -javaagent:/u1/idea-IC-231.9161.38/lib/idea_rt.jar=32889:/u1/idea-IC-231.9161.38/bin -Dfile.encoding=UTF-8 -Dsun.stdout.encoding=UTF-8 -Dsun.stderr.encoding=UTF-8 -classpath /home/tom/IdeaProjects/untitled/out/production/untitled:/u1/home/tom/.m2/repository/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.8.21/kotlin-stdlib-jdk8-1.8.21.jar:/u1/home/tom/.m2/repository/org/jetbrains/kotlin/kotlin-stdlib/1.8.21/kotlin-stdlib-1.8.21.jar:/u1/home/tom/.m2/repository/org/jetbrains/kotlin/kotlin-stdlib-common/1.8.21/kotlin-stdlib-common-1.8.21.jar:/u1/home/tom/.m2/repository/org/jetbrains/annotations/13.0/annotations-13.0.jar:/u1/home/tom/.m2/repository/org/jetbrains/kotlin/kotlin-stdlib-jdk7/1.8.21/kotlin-stdlib-jdk7-1.8.21.jar MainKt
Hello World!
Program arguments:

Process finished with exit code 0
I poke around and find:
/u1/home/tom/IdeaProjects/untitled/out/production/untitled/MainKt.class
But just typing "java MainKt.class" does not work.

What about command line arguments?

Use "Run -- Edit Configuration" and find the place in the form to enter them.

What about Vim?

There is a thing called IdeaVIM.

Type Ctrl-Alt-S to get to the settings window. Select plugins on the left. Type "vim" into the search bar on top. IdeaVIM appeared at the top of the list. Click the "Install button". It takes less than 5 seconds. Then click OK.

And it works!. I am now editing with vim keystrokes.


Have any comments? Questions? Drop me a line!

Adventures in Computing / [email protected]