By the 10th century CE, the Song Dynasty started building the first Chinese junks, which were adopted from the design of the Javanese djongs. The junk rig in particular, became associated with Chinese coast-hugging trading ships. Junks in China were constructed from teak with pegs and nails; they featured watertight compartments and acquired center-mounted tillers and rudders. These ships became the basis for the development of Chinese warships during the Mongol Yuan Dynasty, and were used in the unsuccessful Mongol invasions of Japan and Java.