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

在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>

问题解决

  • 3
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值