Hi I made a Kotlin project in Intellij. Kotlin fil...
# announcements
j
Hi I made a Kotlin project in Intellij. Kotlin files run just fine, however, when I create a java file I can't run it, giving me this error. Do I need to Edit Configurations for Java? I would assume you could run both..
n
I don't think you can put a Java file in the Kotlin directory/source set
j
Hey thanks I figured. How I solved this is by creating a Java project then enabling Kotlin Java Runtime Library. Now I can add both java and kotlin files and run them!
n
creating a src/main/java directory and activating the
java
plugin would also let you do that
👍 1
a
I don't think you can put a Java file in the Kotlin directory/source set
I believe you can, but you need to configure it: https://kotlinlang.org/docs/gradle.html#targeting-javascript
n
gonna assume you meant https://kotlinlang.org/docs/gradle.html#kotlin-and-java-sources but good point. might be easier to create a new directory instead of modifying the build logic tho