Jupiter played an important role in determining the structure and configuration of the Solar System. Whereas hot-Jupiter type exoplanets preferentially form around metal-rich stars, the conditions required for the formation of planets with masses, orbits, and eccentricities comparable to Jupiter (Jupiter analogs) are unknown. Using spectroscopic metallicities, we show that stars hosting Jupiter analogs have an average metallicity close to solar, in contrast to their hot-Jupiter and eccentric cool-Jupiter counterparts, which orbit stars with super-solar metallicities. Furthermore, the eccentricities of Jupiter analogs increase with host-star metallicity, suggesting that planet-planet scatterings producing highly eccentric cool Jupiters could be more common in metal-rich environments. To investigate a possible explanation for these metallicity trends, we compare the observations to numerical simulations, which indicate that metal-rich stars typically form multiple Jupiters, leading to planet-planet interactions and, hence, a prevalence of either eccentric cool Jupiters or hot Jupiters with circularized orbits. Although the samples are small and exhibit variations in their metallicities, suggesting that numerous processes other than metallicity affect the formation of planetary systems, the data in hand suggests that Jupiter analogs and terrestrial-sized planets form around stars with average metallicities close to solar, whereas high-metallicity systems preferentially host eccentric cool Jupiter or hot Jupiters, indicating that higher metallicity systems may not be favorable for the formation of planetary systems akin to the Solar System.