Electromagnetic "rail" guns: In 1918, French inventor Louis Octave Fauchon-Villeplee invented an electric cannon. It was patented in the US in 1922, as an "Electric Apparatus for Propelling Projectiles". The idea was revived by Germany in 1944 as a large scale weapon but a working model was never built and would have been impractical based on the technology of the time. In 1950 a working railgun was used for experimental purposes in Australia.
In Literature, 1897 science fiction novel A Trip to Venus
by John Munro used a "mass driver" calling it an "electric gun". Arthur C Clarke used a fortress based EM gun to shoot a warship in 1955. Gauss rifles became common in the Stainless Steel Rat series by Harry Harrison and Known Space series by Larry Niven in the 1960s.
The "Last Starfighter" used mass drivers to launch asteroids in 1984, but possibly was predated by "This Island Earth", in 1953. Disney's TV movie "Earth Star Voyager" used railguns to launch tracking devices in 1988. Mass Drivers were used to destroy the surface of Narn in Babylon 5 on Oct, 1995.
The US Navy tested a world record mach 8 railgun in Dec, 2010. Warships are expected to field similar weapons by 2020. The next generation of US aircraft carriers are expected to use EM catapults to launch aircraft. http://www.naval-technology.com/projects/dd21/