在github裏下載了zip壓縮包,將kotlin-compiler-1.3.72.zip習慣性地解壓到了D:\Program Files\kotlinc,將此路徑配置到系統環境變量path路徑後,打開cmd,執行"kotlinc -help"後報如下錯誤:
C:\Users\Administrator>kotlinc
錯誤: 找不到或無法加載主類 org.jetbrains.kotlin.preloading.Preloader
問題出在kotlinc編譯器的安裝路徑,D:\Program Files\kotlinc中存在空格。將kotlinc解壓包轉移到其他沒有空格的路徑下,更新環境變量路徑,重新打開cmd執行"kotlinc -help":
C:\Users\Administrator>kotlinc -help
Usage: kotlinc-jvm <options> <source files>
where possible options include:
-classpath (-cp) <path> Paths where to find user class files
-d <directory|jar> Destination for generated class files
-include-runtime Include Kotlin runtime in to resulting .jar
-java-parameters Generate metadata for Java 1.8 reflection on method parameters
-jdk-home <path> Path to JDK home directory to include into classpath, if differs from default JAVA_HOME
-jvm-target <version> Target version of the generated JVM bytecode (1.6 or 1.8), default is 1.6
-module-name <name> Name of the generated .kotlin_module file
-no-jdk Don't include Java runtime into classpath
-no-reflect Don't include kotlin-reflect.jar into classpath
-no-stdlib Don't include kotlin-stdlib.jar or kotlin-reflect.jar into classpath
-script Evaluate the script file
-script-templates <fully qualified class name[,]>
Script definition template classes
-Werror Report an error if there are any warnings
-api-version <version> Allow to use declarations only from the specified version of bundled libraries
-X Print a synopsis of advanced options
-help (-h) Print a synopsis of standard options
-kotlin-home <path> Path to Kotlin compiler home directory, used for runtime libraries discovery
-language-version <version> Provide source compatibility with specified language version
-P plugin:<pluginId>:<optionName>=<value>
Pass an option to a plugin
-nowarn Generate no warnings
-verbose Enable verbose logging output
-version Display compiler version
C:\Users\Administrator>
問題解決