MiraiForum

    • Register
    • Login
    • Search
    • Popular
    • Recent
    • Unsolved
    • Tags
    • Groups
    • 友情链接

    Java集成报错

    BUG反馈
    2
    2
    327
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R
      rmyx666 last edited by

          Bot bot = BotFactory.INSTANCE.newBot(1474855171, password, new BotConfiguration() {{
              // 配置,例如:
              fileBasedDeviceInfo();
          }});
      

      这一行代码报错
      Exception in thread "main" java.lang.NoClassDefFoundError: kotlin/coroutines/EmptyCoroutineContext
      at net.mamoe.mirai.utils.BotConfiguration.<init>(BotConfiguration.kt:64)
      at net.mamoe.mirai.utils.BotConfiguration.<clinit>(BotConfiguration.kt:550)
      at com.tugos.dst.admin.controller.MiraiBotExample.main(MiraiBotExample.java:16)
      Caused by: java.lang.ClassNotFoundException: kotlin.coroutines.EmptyCoroutineContext
      at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
      ... 3 more

      pom文件

          <dependency>
              <groupId>net.mamoe</groupId>
              <artifactId>mirai-core-jvm</artifactId>
              <version>2.16.0</version> 
          </dependency>
      
          <dependency>
              <groupId>org.jetbrains.kotlin</groupId>
              <artifactId>kotlin-stdlib-jdk8</artifactId>
              <version>1.9.0</version>
          </dependency>
      

      java版本1.8

      1 Reply Last reply Reply Quote 0
      • MrXiaoM
        MrXiaoM 童心未泯 last edited by

        推荐使用 gradle, 使用 maven 您可能会遇到各种奇怪的依赖错乱问题
        —— mirai 文档

        缺了啥依赖就补啥,实在不行换 gradle

        1 Reply Last reply Reply Quote 0
        • 1 / 1
        • First post
          Last post
        Powered by Mamoe Technologies & NodeBB | 友情链接 | 服务监控 | Contact