0

I'm working with an INI configuration file in Java and encountering issues with extracting values using both ini4j and IniEditor by Nik Haldimann. The structure of the configuration file is as follows:

ipv4=false
ipv6=false
ssu=false
ntcp2.enabled=false
ssu2.enabled=false
meshnets.yggdrasil=true
[sam]
## Enable the SAM bridge (default: true)
enabled = true
## Address and ports service will listen on (default: 127.0.0.1:7656, udp: 7655)
# address = 127.0.0.1
# port = 7656
# portudp = 7655

The problem I'm facing is that there are no section values such as 'root' or similar. I've attempted to retrieve values using standard methods and both mentioned libraries, but without success.

Could someone guide me on how to properly parse and edit this type of INI configuration file in Java? If there's a recommended library or a standard way to handle such configurations, I'd appreciate the advice.

I tried set "" section.

6
  • Please see the How to Ask page for help clarifying this question. Include the desired behavior, a specific problem or error and the shortest code necessary to reproduce the issue: how to create a Minimal, Complete, and Verifiable example. Recommendations and opinion-based questions are off-topic for Stackoverflow. Commented Mar 10, 2024 at 12:19
  • ini4j would be an option Commented Mar 10, 2024 at 14:44
  • ini4j give an error - Exception in thread "main" org.ini4j.InvalidFileFormatException: parse error (at line: 1): ipv4=false Commented Mar 12, 2024 at 8:45
  • Strange. I didn't get any errors with your file but it did designate the name of the first section with a question mark Commented Mar 12, 2024 at 8:48
  • github.com/PurpleI2P/i2pd-android/pull/66 Apache common INI library are works perfect. org.apache.commons:commons-configuration2:2.3 Commented Mar 14, 2024 at 13:03

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.