在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>
问题解决