The worshiping of Idols in Java is related to the expanse of Hinduism and Buddhism there,
Step-by-step explanation:
Java was one of the influenced kingdoms of Indian and mainly south Indian kings who had installed dynasties in the region making some of the first kingdoms there .
They had also brought their Hindu religion with them and some Buddhist missionaries had also reached.
The idols they were thus worshiping were Hindu as reported by Marco polo in his travels because they took their culture from the predominantly Hindu south India.