Nearly 20 people have been killed and at least 300 injured in an earthquake that rattled Indonesia's main island of Java on Monday, a local official from the town worst-hit by the tremor told local media, AFP reported.

"The information I got for now, in this hospital alone, nearly 20 died and at least 300 people are being treated. Most of them had fractures from being trapped by the ruins of buildings," the head of Cianjur's administration, Herman Suherman, told broadcaster Metro TV.

At present, it is known that seven residential buildings were damaged, as well as schools, hospitals, and several administrative buildings.