Percy Spencer invented the microwave oven after observing that a candy bar in his pocket melted near active radar equipment during his work developing radar technology for the military during World War II. He experimented by microwaving popcorn kernels and other foods, creating the first microwave oven from a high-density electromagnetic field generator enclosed in a metal box. Raytheon patented and first sold the large and expensive Radarange microwave oven commercially in 1947. It was not until 1967 that a reasonably sized and affordable countertop microwave became generally available for home use.