menu

Questions & Answers

How to get Kotlinc 1.8.0 to run with Ubuntu on Windows

I installed Kotlinc through the zip file kotlin-compiler-1.8.0.zip and extracted it and moved the kotlinc\bin files to my C:\Program files. I later then verified that I had installed it correctly by running the kotlinc -version command in the terminal and got back info: kotlinc-jvm 1.5.21 (JRE 16.0.2+7-67). So I believe I have that working just fine. So I believe now the error is arising from Java somehow.

When I go to run my simple hello world program with this:

kotlinc main.kt -include-runtime -d main.jar

I am met with the error:

/mnt/c/Program Files/kotlinc/bin/kotlinc: line 98: java: command not found

Previously I was just getting: kotlinc command not found. I later read on StackOverflow someone else was having the same problem and the answer to that solution was just add it to the environment Variable path, in which I did but I very soon then ran into this issue.

I have since tried everything I have came across on this issue, I've reinstalled the kotlinc compiler and java and put the Java\jdk16.0.2\bin in my environment variable path as well. When I try to run the simple command kotlinc help in Ubuntu I am also met with the same line 98: java command not found error.

Comments:
2023-01-25 00:00:06
Did you install java inside WSL? What happens when you run java -version in WSL?
2023-01-25 00:00:06
@Joffrey thank you so much, I cant believe I overlooked that. I checked and it was not installed inside WSL and when I installed it and ran the line to run my program it worked! Thank you
Answers(0) :