Cubeb berries are native to Java and Sumatra [present-day Indonesia], and came to Europe, via India, through trade with Arab spice merchants. The Book of One Thousand and One Nights, compiled in the 9th century, mentions cubeb as a remedy for infertility. Many cultures, from China to Greece, India to Italy, widely considered cubeb berries a powerful aphrodisiac. Curiously [or not], Cubeb was also, simultaneously, thought by the people of Europe to be repulsive to demons, just as it was by the people of China.
Today, cubeb berries are used as a flavoring agent for gins [like Bombay Sapphire gin] and for cigarettes in the West. Java pepper is also used to enhance the flavor of savory dishes, like soups and stews. In Moroccan cuisine, cubeb is used in savory dishes and in pastries like markouts, little diamonds of semolina with honey and dates. Cubeb also appears occasionally in the list of ingredients for the famed spice mixture Ras el hanout. In Indonesian cuisine, especially in Indonesian gules (curries), cubeb is frequently used.
Try cubeb berries in your pepper grinder next time it needs a refill.