In this tutorial, Learn ini file cheatsheet with an example.

Sample INI File example

[http]
port=8080
username=httpuser
[https]
port=8043
username=httpsuser
[FTP]
port=8043
username=ftpuser
[database]
driverclass   = com.mysql.jdbc.Driver
dbName        = mydatabase
port          = 3306
username      = root
password      =

INI file cheat sheet

Comment syntax starts with a semicolon ; followed by comment text Section or header are declared new line with square brackets[] followed by key and values options can be declared with the same key and multiple values Each line of an element contains keys and values

values of any type, String, number, boolean, enum, array, or map

; comment declared
; sections defined with multiple values
[Section-name]
key=value

; sections defined with multiple values
option1=true # in-line comments
option1=false

; different values of data

number1=123
number1_hexa=0x123
number1_octa=0123
number1_binary=0b1111
float_number1=123.12

;boolean values
value1=true
value2=false
  • the key is a valid identifier that will not contain = or ; symbols.
  • The value is the valid identifier of any string
  • Key can be String, number, or Boolean values.