i’m sure i’m just doing something silly, but i’ve ...
# spring
b
i’m sure i’m just doing something silly, but i’ve got a spring boot project containing:
Copy code
src/main/kotlin/com/foo/Blah.java
src/main/kotlin/com/foo/bar/WebController.kt
WebController instantiates and uses a Blah. at compile time, no issues. when i start the app with
gradle bootRun
- at runtime i get:
java.lang.NoClassDefFoundError: com/foo/Blah
i shouldn’t have to do anything special to make sure the java classes are on the classpath, right?
ahhh, it looks like by default the java does have to be under
src/main/java
? This documentation appears to be misleading: https://kotlinlang.org/docs/mixing-java-kotlin-intellij.html#adding-java-source-code-to-an-existing-kotlin-project
t
Would agree with this assumption. And also wonder that the error is showing com/foo/bar/Blah, while your class is in com/foo/ directory
b
sorry, i obfuscated the actual paths, and fatfingered it:D
t
sure good luck:-)
b
so,
.kt
and
.java
in
src/main/java
work just fine by default.
.java
in
src/main/kotlin
does not.
solution: just stick everything in
src/main/java
t
👍