gpt4 book ai didi

java - 读取toml文件java

转载 作者:行者123 更新时间:2023-11-29 08:39:49 27 4
gpt4 key购买 nike

我是第一次在 java 中使用 toml。我配置了 pom.xml 依赖项,我想从 .toml 文件中读取。

Toml toml = new Toml().read(newFileInputStream("/home/abdallah/Desktop/config.toml"))

我收到这个错误:

Exception in thread "main" java.lang.NoClassDefFoundError: com/google/gson/Gson

Caused by: java.lang.ClassNotFoundException: com.google.gson.Gson

这行代码给我这个错误。我想问一下如何使用 .read() 方法在 java 中读取 toml 文件

谢谢

最佳答案

问题是你在 maven 中添加了 toml 依赖,但你没有添加 com.google.gson ,因此错误不是 .read 方法。添加 com.google.gson 依赖项即可!

关于java - 读取toml文件java,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41142268/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com