Unable to Run Kotlin Application in Eclipse

让人想犯罪 __ 提交于 2019-12-04 22:23:47
user7955150

Try new Kotlin File instead of Kotlin Class:

For me it happened only once. I think this is some glitch from the Kotlin plugin, when you first create a Kotlin file and try run it. Try "new Kotlin class" paste the same content and see if it works. After that you should be able to run both files as it happened to me.

I got same issues as you. I tried a lot of ways but not work (like uninstall plugin, then install plugin again, delete project and create new project...)

How to fix: I created a new workspace and setup the helloworld project again. I see that class file generated and I can run it normally.

Note that, we create new workspace and not project. What I notice is workspace contain .metadata folder that may have lot of information for Eclipse.

I had the same problem, it solved by deleting the JAVA_HOME environment variable.

I have set an old JDK folder that I deleted in the JAVA_HOME environment variable.

Tried with Java 8 (1.8.0_144) and Eclipse Oxygen.1a Release (4.7.1a - build id 20171005-1200) with the following plugin versions:

  Kotlin    0.8.2.v20170314-0957    org.jetbrains.kotlin.feature.feature.group  JetBrains
    kotlin-eclipse-policy   0.8.2.v20170314-0957    org.jetbrains.kotlin.policy.feature.group   JetBrains
    kotlin-weaving-feature  0.8.2.v20170314-0957    org.jetbrains.kotlin.weaving.feature.feature.group  JetBrains

Everything worked as expected, without the need to create a separate workspace and/or use Kotlin File instead of Kotlin Class:

This worked for me.... If you go to Window -> Show View -> Navigator It shows you more a physical layout of your workspace rather than the logical view by the Package Explorer. Right click the kotlin file with the main function defined and click Run As -> Kotlin Application. Worked for me, though I'd kill to be able to use a regular run config but such is life.....

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!