score:0

add kotlin nature fixes the issue. click on your project and configure kotlin -> add kotlin nature

score:0

as of the current eclipse version (2019-09):

you can't add kotlin to a java project, but you can add java to a kotlin project.

the procedure to accomplish a mixed kotlin/java project was roughly:

  1. install kotlin plug-in
  2. create empty kotlin project
  3. move the java code into the kotlin project
  4. delete the original project
  5. fix project references

score:0

i'm working on a project with spring boot and kotlin (some controllers/mappers/classes in java and others in kotlin) and after trying a lot of approaches, the only that worked was to use eclipse 03-2020 and kotlin plugin for eclipse v0.8.19.

https://dl.bintray.com/jetbrains/kotlin/eclipse-plugin/0.8.19/

  • before everything, close your project and uninstall the previous version of kotlin plugin for eclipse.
  • go to help/install new software.
  • copy the link of eclipse plugin and continue with the installation (do not forget to check all the options to install).
  • after the installation restart the ide and try compile again.

score:0

if your project was like mine, it has .kt files in /src/main/kotlin, some missing references in java. i tried compiling them but nothing worked. it turns out that my project didn't have an eclipse source folder associated with the kotlin code. there were the usual ones for "src/main/java", "src/main/resources" but not one for "src/main/kotlin".

so, i created a source folder for the kotlin files.

  1. right click the project
  2. new "source folder"
  3. specify folder name: "/src/main/kotlin"

this doesn't create anything in the file system but just creates a logical container for eclipse to work with the contents. in this case, eclipse recognized the .kt files, compiled them and all the missing references issues all cleared up.

score:1

got similar issue solved by adding a new kotlin file to a kotlin/java mixed project. adding the file caused eclipse 2018-09 (4.9.0) to add kotlin-stdlib.jar and kotlin-reflect.jar to classpath and everything started working.

score:16

add kotlin nature fixes the issue. click on your project and configure kotlin -> add kotlin nature

this partially fixes the issue, though eclipse plugin is still buggy and auto import function still doesn't work for me.

if you're having any issue, make sure you have kotlin_bin folder added in your project. also make sure that all kotlin files have the correct package name sometimes when you rename packages or move files around kotlin classes may not get updated.


Related Query

More Query from same tag