She was named for the American victory over HMS Java off the coast of Brazil on 29 December 1812, captured by the Constitution under the command of Captain William Bainbridge.
[4] Java, Captain Oliver Hazard Perry in command, got underway from Baltimore 5 August 1815, picked up spare rigging at Hampton Roads and New York, and sailed to Newport, Rhode Island, to fill out her crew.
Ordered to the Mediterranean to serve in the Second Barbary War, the new frigate departed from Newport 22 January 1816 in the face of a bitter gale.
Next she sailed for Tripoli with Constellation, Ontario, and Erie to show the strength and resolve of the United States.
Then, after a cruise in the Mediterranean stopping at Syracuse, Messina, Palermo, Tunis, Gibraltar and Naples, the frigate returned to Newport early in 1817 and was laid up at Boston, Massachusetts.