简体   繁体   中英

Read from toml file java

I am using toml with java for the first time.I configured the pom.xml dependencies and i want to read from the .toml file.

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

I am getting this error:

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

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

It is giving me this error in this line of code.I want to ask how can i read the toml file in java using the .read() method

thank you

The problem is that you added toml dependency in maven , but you didn't add com.google.gson , and thus the error is not the .read method. Add com.google.gson dependency and it works!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM