MiraiForum

    • 注册
    • 登录
    • 搜索
    • 热门
    • 最新
    • 未解决
    • 标签
    • 群组
    • 友情链接

    Java集成报错

    BUG反馈
    2
    2
    325
    正在加载更多帖子
    • 从旧到新
    • 从新到旧
    • 最多赞同
    回复
    • 在新帖中回复
    登录后回复
    此主题已被删除。只有拥有主题管理权限的用户可以查看。
    • R
      rmyx666 最后由 编辑

          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 条回复 最后回复 回复 引用 0
      • MrXiaoM
        MrXiaoM 童心未泯 最后由 编辑

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

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

        1 条回复 最后回复 回复 引用 0
        • 1 / 1
        • First post
          Last post
        Powered by Mamoe Technologies & NodeBB | 友情链接 | 服务监控 | Contact