Intellij Idea 如何让koltin从IntelliJ UI运行?

eqoofvh9  于 2023-06-21  发布在  其他
关注(0)|答案(2)|浏览(141)

Main.kt

package net.kolotyluk.nima.advent

fun main() {
    println("What's your name?")
}

"C:\Program Files\Java\jdk-19\bin\java.exe" -Dfile.encoding=windows-1252 -Dsun.stdout.encoding=windows-1252 -Dsun.stderr.encoding=windows-1252 -jar C:\Users\ERIC\Documents\git\helidon-nima-example\advent\target\advent-1.0-SNAPSHOT.jar
What's your name?

Process finished with exit code 0

"C:\Program Files\Java\jdk-19\bin\java.exe" --enable-preview "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2023.1\lib\idea_rt.jar=50405:C:\Program Files\JetBrains\IntelliJ IDEA 2023.1\bin" -Dfile.encoding=UTF-8 -Dsun.stdout.encoding=UTF-8 -Dsun.stderr.encoding=UTF-8 -classpath C:\Users\ERIC\Documents\git\helidon-nima-example\advent\target\classes;C:\Users\ERIC\.m2\repository\org\jetbrains\kotlin\kotlin-stdlib-jdk8\1.8.22\kotlin-stdlib-jdk8-1.8.22.jar;C:\Users\ERIC\.m2\repository\org\jetbrains\kotlin\kotlin-stdlib\1.8.22\kotlin-stdlib-1.8.22.jar;C:\Users\ERIC\.m2\repository\org\jetbrains\kotlin\kotlin-stdlib-common\1.8.22\kotlin-stdlib-common-1.8.22.jar;C:\Users\ERIC\.m2\repository\org\jetbrains\annotations\13.0\annotations-13.0.jar;C:\Users\ERIC\.m2\repository\org\jetbrains\kotlin\kotlin-stdlib-jdk7\1.8.22\kotlin-stdlib-jdk7-1.8.22.jar;C:\Users\ERIC\.m2\repository\io\helidon\microprofile\bundles\helidon-microprofile-core\4.0.0-ALPHA4\helidon-microprofile-core-4.0.0-ALPHA4.jar;C:\Users\ERIC\.m2\repository\io\helidon\microprofile\server\helidon-microprofile-server\4.0.0-ALPHA4\helidon-microprofile-server-4.0.0-ALPHA4.jar;C:\Users\ERIC\.m2\repository\io\helidon\microprofile\cdi\helidon-microprofile-cdi\4.0.0-ALPHA4\helidon-microprofile-cdi-4.0.0-ALPHA4.jar;C:\Users\ERIC\.m2\repository\io\helidon\microprofile\weld\weld-se-core\4.0.0-ALPHA4\weld-se-core-4.0.0-ALPHA4.jar;C:\Users\ERIC\.m2\repository\io\helidon\microprofile\weld\weld-core-impl\4.0.0-ALPHA4\weld-core-impl-4.0.0-ALPHA4.jar;C:\Users\ERIC\.m2\repository\org\jboss\weld\environment\weld-environment-common\4.0.2.Final\weld-environment-common-4.0.2.Final.jar;C:\Users\ERIC\.m2\repository\org\jboss\weld\weld-api\4.0.SP1\weld-api-4.0.SP1.jar;C:\Users\ERIC\.m2\repository\org\jboss\weld\weld-spi\4.0.SP1\weld-spi-4.0.SP1.jar;C:\Users\ERIC\.m2\repository\org\jboss\logging\jboss-logging\3.4.2.Final\jboss-logging-3.4.2.Final.jar;C:\Users\ERIC\.m2\repository\org\jboss\classfilewriter\jboss-classfilewriter\1.2.5.Final\jboss-classfilewriter-1.2.5.Final.jar;C:\Users\ERIC\.m2\repository\io\helidon\common\features\helidon-common-features\4.0.0-ALPHA4\helidon-common-features-4.0.0-ALPHA4.jar;C:\Users\ERIC\.m2\repository\io\helidon\common\features\helidon-common-features-api\4.0.0-ALPHA4\helidon-common-features-api-4.0.0-ALPHA4.jar;C:\Users\ERIC\.m2\repository\io\helidon\nima\webserver\helidon-nima-webserver-static-content\4.0.0-ALPHA4\helidon-nima-webserver-static-content-4.0.0-ALPHA4.jar;C:\Users\ERIC\.m2\repository\io\helidon\nima\webserver\helidon-nima-webserver-context\4.0.0-ALPHA4\helidon-nima-webserver-context-4.0.0-ALPHA4.jar;C:\Users\ERIC\.m2\repository\io\helidon\jersey\helidon-jersey-server\4.0.0-ALPHA4\helidon-jersey-server-4.0.0-ALPHA4.jar;C:\Users\ERIC\.m2\repository\org\glassfish\jersey\core\jersey-server\3.0.9\jersey-server-3.0.9.jar;C:\Users\ERIC\.m2\repository\jakarta\validation\jakarta.validation-api\3.0.0\jakarta.validation-api-3.0.0.jar;C:\Users\ERIC\.m2\repository\org\glassfish\jersey\ext\cdi\jersey-weld2-se\3.0.9\jersey-weld2-se-3.0.9.jar;C:\Users\ERIC\.m2\repository\org\glassfish\jersey\ext\cdi\jersey-cdi1x\3.0.9\jersey-cdi1x-3.0.9.jar;C:\Users\ERIC\.m2\repository\io\helidon\jersey\helidon-jersey-media-jsonp\4.0.0-ALPHA4\helidon-jersey-media-jsonp-4.0.0-ALPHA4.jar;C:\Users\ERIC\.m2\repository\org\glassfish\jersey\media\jersey-media-json-processing\3.0.9\jersey-media-json-processing-3.0.9.jar;C:\Users\ERIC\.m2\repository\org\eclipse\parsson\parsson-media\1.0.2\parsson-media-1.0.2.jar;C:\Users\ERIC\.m2\repository\io\helidon\microprofile\config\helidon-microprofile-config\4.0.0-ALPHA4\helidon-microprofile-config-4.0.0-ALPHA4.jar;C:\Users\ERIC\.m2\repository\io\helidon\config\helidon-config-mp\4.0.0-ALPHA4\helidon-config-mp-4.0.0-ALPHA4.jar;C:\Users\ERIC\.m2\repository\io\helidon\config\helidon-config-encryption\4.0.0-ALPHA4\helidon-config-encryption-4.0.0-ALPHA4.jar;C:\Users\ERIC\.m2\repository\io\helidon\common\helidon-common-crypto\4.0.0-ALPHA4\helidon-common-crypto-4.0.0-ALPHA4.jar;C:\Users\ERIC\.m2\repository\io\helidon\config\helidon-config-object-mapping\4.0.0-ALPHA4\helidon-config-object-mapping-4.0.0-ALPHA4.jar;C:\Users\ERIC\.m2\repository\io\helidon\common\helidon-common\4.0.0-ALPHA4\helidon-common-4.0.0-ALPHA4.jar;C:\Users\ERIC\.m2\repository\jakarta\annotation\jakarta.annotation-api\2.0.0\jakarta.annotation-api-2.0.0.jar;C:\Users\ERIC\.m2\repository\jakarta\enterprise\jakarta.enterprise.cdi-api\3.0.0\jakarta.enterprise.cdi-api-3.0.0.jar;C:\Users\ERIC\.m2\repository\jakarta\el\jakarta.el-api\4.0.0\jakarta.el-api-4.0.0.jar;C:\Users\ERIC\.m2\repository\jakarta\interceptor\jakarta.interceptor-api\2.0.0\jakarta.interceptor-api-2.0.0.jar;C:\Users\ERIC\.m2\repository\jakarta\inject\jakarta.inject-api\2.0.0\jakarta.inject-api-2.0.0.jar;C:\Users\ERIC\.m2\repository\jakarta\ws\rs\jakarta.ws.rs-api\3.0.0\jakarta.ws.rs-api-3.0.0.jar;C:\Users\ERIC\.m2\repository\jakarta\json\bind\jakarta.json.bind-api\2.0.0\jakarta.json.bind-api-2.0.0.jar;C:\Users\ERIC\.m2\repository\jakarta\xml\bind\jakarta.xml.bind-api\3.0.1\jakarta.xml.bind-api-3.0.1.jar;C:\Users\ERIC\.m2\repository\com\sun\activation\jakarta.activation\2.0.1\jakarta.activation-2.0.1.jar;C:\Users\ERIC\.m2\repository\org\glassfish\jersey\media\jersey-media-json-binding\3.0.9\jersey-media-json-binding-3.0.9.jar;C:\Users\ERIC\.m2\repository\org\glassfish\jersey\core\jersey-common\3.0.9\jersey-common-3.0.9.jar;C:\Users\ERIC\.m2\repository\org\glassfish\hk2\osgi-resource-locator\1.0.3\osgi-resource-locator-1.0.3.jar;C:\Users\ERIC\.m2\repository\jakarta\json\jakarta.json-api\2.0.1\jakarta.json-api-2.0.1.jar;C:\Users\ERIC\.m2\repository\org\eclipse\parsson\parsson\1.0.2\parsson-1.0.2.jar;C:\Users\ERIC\.m2\repository\org\eclipse\yasson\2.0.4\yasson-2.0.4.jar;C:\Users\ERIC\.m2\repository\org\glassfish\jakarta.json\2.0.0\jakarta.json-2.0.0-module.jar;C:\Users\ERIC\.m2\repository\org\glassfish\jersey\core\jersey-client\3.0.9\jersey-client-3.0.9.jar;C:\Users\ERIC\.m2\repository\org\glassfish\jersey\inject\jersey-hk2\3.0.9\jersey-hk2-3.0.9.jar;C:\Users\ERIC\.m2\repository\org\glassfish\hk2\hk2-locator\3.0.3\hk2-locator-3.0.3.jar;C:\Users\ERIC\.m2\repository\org\glassfish\hk2\external\aopalliance-repackaged\3.0.3\aopalliance-repackaged-3.0.3.jar;C:\Users\ERIC\.m2\repository\org\glassfish\hk2\hk2-api\3.0.3\hk2-api-3.0.3.jar;C:\Users\ERIC\.m2\repository\org\glassfish\hk2\hk2-utils\3.0.3\hk2-utils-3.0.3.jar;C:\Users\ERIC\.m2\repository\org\javassist\javassist\3.29.0-GA\javassist-3.29.0-GA.jar;C:\Users\ERIC\.m2\repository\io\helidon\config\helidon-config-yaml-mp\4.0.0-ALPHA4\helidon-config-yaml-mp-4.0.0-ALPHA4.jar;C:\Users\ERIC\.m2\repository\org\eclipse\microprofile\config\microprofile-config-api\3.0.1\microprofile-config-api-3.0.1.jar;C:\Users\ERIC\.m2\repository\io\helidon\nima\webserver\helidon-nima-webserver\4.0.0-ALPHA4\helidon-nima-webserver-4.0.0-ALPHA4.jar;C:\Users\ERIC\.m2\repository\io\helidon\common\helidon-common-http\4.0.0-ALPHA4\helidon-common-http-4.0.0-ALPHA4.jar;C:\Users\ERIC\.m2\repository\io\helidon\common\helidon-common-buffers\4.0.0-ALPHA4\helidon-common-buffers-4.0.0-ALPHA4.jar;C:\Users\ERIC\.m2\repository\io\helidon\common\helidon-common-mapper\4.0.0-ALPHA4\helidon-common-mapper-4.0.0-ALPHA4.jar;C:\Users\ERIC\.m2\repository\io\helidon\common\helidon-common-media-type\4.0.0-ALPHA4\helidon-common-media-type-4.0.0-ALPHA4.jar;C:\Users\ERIC\.m2\repository\io\helidon\common\helidon-common-uri\4.0.0-ALPHA4\helidon-common-uri-4.0.0-ALPHA4.jar;C:\Users\ERIC\.m2\repository\io\helidon\common\helidon-common-parameters\4.0.0-ALPHA4\helidon-common-parameters-4.0.0-ALPHA4.jar;C:\Users\ERIC\.m2\repository\io\helidon\common\helidon-common-socket\4.0.0-ALPHA4\helidon-common-socket-4.0.0-ALPHA4.jar;C:\Users\ERIC\.m2\repository\io\helidon\common\helidon-common-context\4.0.0-ALPHA4\helidon-common-context-4.0.0-ALPHA4.jar;C:\Users\ERIC\.m2\repository\io\helidon\common\helidon-common-key-util\4.0.0-ALPHA4\helidon-common-key-util-4.0.0-ALPHA4.jar;C:\Users\ERIC\.m2\repository\io\helidon\common\helidon-common-configurable\4.0.0-ALPHA4\helidon-common-configurable-4.0.0-ALPHA4.jar;C:\Users\ERIC\.m2\repository\io\helidon\common\helidon-common-security\4.0.0-ALPHA4\helidon-common-security-4.0.0-ALPHA4.jar;C:\Users\ERIC\.m2\repository\io\helidon\nima\common\helidon-nima-common-tls\4.0.0-ALPHA4\helidon-nima-common-tls-4.0.0-ALPHA4.jar;C:\Users\ERIC\.m2\repository\io\helidon\nima\http\media\helidon-nima-http-media\4.0.0-ALPHA4\helidon-nima-http-media-4.0.0-ALPHA4.jar;C:\Users\ERIC\.m2\repository\io\helidon\nima\http\encoding\helidon-nima-http-encoding\4.0.0-ALPHA4\helidon-nima-http-encoding-4.0.0-ALPHA4.jar;C:\Users\ERIC\.m2\repository\io\helidon\pico\builder\config\helidon-pico-builder-config\4.0.0-ALPHA4\helidon-pico-builder-config-4.0.0-ALPHA4.jar;C:\Users\ERIC\.m2\repository\io\helidon\builder\helidon-builder\4.0.0-ALPHA4\helidon-builder-4.0.0-ALPHA4.jar;C:\Users\ERIC\.m2\repository\io\helidon\common\helidon-common-config\4.0.0-ALPHA4\helidon-common-config-4.0.0-ALPHA4.jar;C:\Users\ERIC\.m2\repository\io\helidon\nima\webclient\helidon-nima-webclient\4.0.0-ALPHA4\helidon-nima-webclient-4.0.0-ALPHA4.jar;C:\Users\ERIC\.m2\repository\io\helidon\nima\http2\helidon-nima-http2-webclient\4.0.0-ALPHA4\helidon-nima-http2-webclient-4.0.0-ALPHA4.jar;C:\Users\ERIC\.m2\repository\io\helidon\nima\http2\helidon-nima-http2\4.0.0-ALPHA4\helidon-nima-http2-4.0.0-ALPHA4.jar;C:\Users\ERIC\.m2\repository\io\helidon\nima\http2\helidon-nima-http2-webserver\4.0.0-ALPHA4\helidon-nima-http2-webserver-4.0.0-ALPHA4.jar;C:\Users\ERIC\.m2\repository\io\helidon\nima\http\media\helidon-nima-http-media-jsonp\4.0.0-ALPHA4\helidon-nima-http-media-jsonp-4.0.0-ALPHA4.jar;C:\Users\ERIC\.m2\repository\io\helidon\nima\observe\helidon-nima-observe-health\4.0.0-ALPHA4\helidon-nima-observe-health-4.0.0-ALPHA4.jar;C:\Users\ERIC\.m2\repository\io\helidon\nima\observe\helidon-nima-observe\4.0.0-ALPHA4\helidon-nima-observe-4.0.0-ALPHA4.jar;C:\Users\ERIC\.m2\repository\io\helidon\nima\helidon-nima\4.0.0-ALPHA4\helidon-nima-4.0.0-ALPHA4.jar;C:\Users\ERIC\.m2\repository\io\helidon\nima\webserver\helidon-nima-webserver-cors\4.0.0-ALPHA4\helidon-nima-webserver-cors-4.0.0-ALPHA4.jar;C:\Users\ERIC\.m2\repository\io\helidon\cors\helidon-cors\4.0.0-ALPHA4\helidon-cors-4.0.0-ALPHA4.jar;C:\Users\ERIC\.m2\repository\io\helidon\health\helidon-health\4.0.0-ALPHA4\helidon-health-4.0.0-ALPHA4.jar;C:\Users\ERIC\.m2\repository\io\helidon\nima\service-common\helidon-nima-service-common\4.0.0-ALPHA4\helidon-nima-service-common-4.0.0-ALPHA4.jar;C:\Users\ERIC\.m2\repository\io\helidon\health\helidon-health-checks\4.0.0-ALPHA4\helidon-health-checks-4.0.0-ALPHA4.jar;C:\Users\ERIC\.m2\repository\io\helidon\config\helidon-config\4.0.0-ALPHA4\helidon-config-4.0.0-ALPHA4.jar;C:\Users\ERIC\.m2\repository\io\helidon\logging\helidon-logging-jul\4.0.0-ALPHA4\helidon-logging-jul-4.0.0-ALPHA4.jar;C:\Users\ERIC\.m2\repository\io\helidon\logging\helidon-logging-common\4.0.0-ALPHA4\helidon-logging-common-4.0.0-ALPHA4.jar;C:\Users\ERIC\.m2\repository\io\helidon\config\helidon-config-yaml\4.0.0-ALPHA4\helidon-config-yaml-4.0.0-ALPHA4.jar;C:\Users\ERIC\.m2\repository\org\yaml\snakeyaml\1.32\snakeyaml-1.32.jar net.kolotyluk.nima.advent.MainKt
Error: Could not find or load main class net.kolotyluk.nima.advent.MainKt
Caused by: java.lang.ClassNotFoundException: net.kolotyluk.nima.advent.MainKt

Process finished with exit code 1

我注意到在target目录中,我找不到任何net.kolotyluk.nima.advent.MainKt的类文件,但它似乎在JAR文件中找到了它...
我从来没有在IntelliJ中运行一个简单的Hello-World风格的程序时遇到过这么大的麻烦。为什么IntelliJ没有创建任何类文件,而mvn clean package正确地构建了JAR文件?

pod7payv

pod7payv1#

据我所知,这是一个IntelliJ缺陷。当我做mvn compile时,我得到

而且我可以正常地从IntelliJ UI运行我的程序。
缺陷似乎是IntelliJ -> Build/Rebuild由于某种原因没有创建类文件。可能是一些Maven设置混淆了IntelliJ,因为早些时候IntelliJ抱怨它找不到输出目录...

qaxu7uf2

qaxu7uf22#

问题是IntelliJ不会自动找到Kotlinstd库/DevKit。你必须进入设置,构建等,并手动找到Kotlinstd库在系统上的位置,以便它工作。我也经历过同样的事情。

相关问题