安装kotlin命令行编译器出现错误“找不到或无法加载主类 org.jetbrains.kotlin.preloading.Preloader”的解决办法

  在github里下载了zip压缩包,将kotlin-compiler-1.2.50.zip习惯性地解压到了D:\Program Files\kotlinc,将此路径配置到系统环境变量path路径后,打开cmd,执行"kotlinc -help"后报如下错误:

C:\Users\Administrator.000>kotlinc -help
错误: 找不到或无法加载主类 org.jetbrains.kotlin.preloading.Preloader

  问题出在kotlinc编译器的安装路径,D:\Program Files\kotlinc中存在空格。将kotlinc解压包转移到其他没有空格的路径下,更新环境变量路径,重新打开cmd执行"kotlinc -help":

C:\Users\Administrator.000>kotlinc -help
Usage: kotlinc-jvm  
where possible options include:
  -classpath (-cp)     Paths where to find user class files
  -d          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 to JDK home directory to include into classpath, if differs from default JAVA_HOME
  -jvm-target       Target version of the generated JVM bytecode (1.6 or 1.8), default is 1.6
  -module-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 
                             Script definition template classes
  -Werror                    Report an error if there are any warnings
  -api-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 to Kotlin compiler home directory, used for runtime libraries discovery
  -language-version  Provide source compatibility with specified language version
  -P plugin::=
                             Pass an option to a plugin
  -nowarn                    Generate no warnings
  -verbose                   Enable verbose logging output
  -version                   Display compiler version

C:\Users\Administrator.000>

问题解决!!

你可能感兴趣的:(安装kotlin命令行编译器出现错误“找不到或无法加载主类 org.jetbrains.kotlin.preloading.Preloader”的解决办法)