I'm trying to setup my Kotlin project to run in WS...
# intellij
I'm trying to setup my Kotlin project to run in WSL, but I just get this error and have no clue on how to fix it.
I have installed
, but can't figure out how get intellij to use this
running any gradle tasks like this
./gradlew build
, works without any problems. But I would like IntelliJ to be fully compatable with my project
gradle jdk is set to the same as your JAVA_HOME?
I have no clue. I just know this and none of the options under "Gradle JVM" work
returns nothing when running in ubuntu terminal
I don't use windows or WSL for that matter, but I do know that I've had a bunch of issues with the JDKs not matching up with the one that is set for my project and the one that is output when I echo. Personally, I would focus on trying to get JAVA_HOME to echo properly as I think a lot of things in intellij require it.
I always have a bunch of issues with gradle and jvm settings, which is why I started using this:
Copy code
compileKotlin { kotlinOptions.jvmTarget = "15" }
compileTestKotlin { kotlinOptions.jvmTarget = "15" }
java {
    toolchain {
But I don't think intellij uses this for anything?
I will try and figure out the JAVA_HOME variable 👍
Intellij seems to look here for env vars https://github.com/JetBrains/intellij-community/blob/master/plugins/terminal/resources/jediterm-bash.in and so with that said I think it you find that you can't echo JAVA_HOME inside of terminal then that might be your problem
I've also seen that "shell integration" being selected is sometimes a culprit. Anyway. I hope I did not mislead you. Just giving you a heads up that this was the issue for me (but not on windows or wsl).
I have setup intellij to use wsl ubuntu in the terminal settings, that worked in windows projects and now in wsl projects it's also working fine. Seems it's just gradle/kotlin that is not working.
I got it working!
Oooh! What was it?
just ran
./gradlew build
which then did downloaded all of the required stuff, then when opening that gradle jvm settings page, it now gave me the option to select WSL version
Ah nice. 💯
I'm picking up a windows laptop in about ~3 months and def want to use WSL so hoefully this info will come in handy. 😃
👍 1
or not, it gave me a new error and without any information...
😭 1
Got it working now. Need to make sure that: •
Project Structure > Project > Project SDK
is using a (WSL) version. •
Settings > Build > Build Tools > Gradle
has: ◦ A WSL path for
Gradle user home
Use Gradle from
is set to
gradle-wrapper.properties file
Gradle JVM
is using a (WSL) version And if intellij can't find any WSL versions, just run
./gradlew build
. And if this command doesn't work, then you can always google it 😛
🎉 1
Nah not fully working, I'll just give up and try again in a few months. I'm guessing JetBrains are working on improving the experience on this.
😭 1
Maybe worth filing a bug?
Maybe I will try more in my free time. Too time expensive to get it to work in work hours 😛