In 1964, the character was spun off into his own series, “Gomer Pyle, U.S.M.C.,” in which Gomer, still bumbling but well meaning, joined the Marines and, on a weekly basis, tried the patience of his loudmouthed drill sergeant, Vince Carter (Frank Sutton).
Gomer was a recognizable kind of American hero: a good-hearted, gentle, unsophisticated sort (not unlike Forrest Gump of a later era) who encounters a harder, more cynical modern world — in this case embodied by Southern California — and helps redeem it.
“Sheldon Leonard and his co-creators astutely chose a Southern California Marine base for their hero,” Gerard Jones wrote in his 1992 history of the American sitcom, “Honey, I’m Home!”
He added: “In various episodes Gomer connected with the movie and TV industries, the music business, the surf scene, the Beverly Hills rich — all the easy symbols of modernity. Everywhere he went he left a trail of fond smiles and innocence — at least temporarily — restored.”
But “one thing Gomer never, ever connected with,” Mr. Jones added, “was the Vietnam War,” which was raging at the time, just as he and his neighbors in Mayberry had remained isolated from the civil rights movement in the South. “He somehow existed in the peacetime military when there was no peace.”
Mr. Nabors first showed off his booming singing voice for a national TV audience in a guest appearance on “The Danny Kaye Show” in 1964. To fans who knew him only as Gomer, his full-throated, almost operatic baritone was surprisingly striking, if strangely incongruous.
“Gomer Pyle, U.S.M.C.” lasted five seasons, ending in 1969, when Mr. Nabors was given his own CBS variety show and with it more opportunities to sing. “The Jim Nabors Hour” lasted until 1971. In 1975 and 1976, he and Ruth Buzzi starred as a pair of androids in the ABC children’s show “The Lost Saucer.” He was a frequent guest on “The Carol Burnett Show.”
He also made dozens of albums, recording ballads, show tunes, gospel and sacred music, country songs and Christmas carols, and performed regularly in Las Vegas showrooms and in concert. He regularly sang “Back Home Again in Indiana” at the Indianapolis 500 auto race, first in 1972 and most recently in 2014.
Mr. Nabors played supporting roles in three movies starring his friend Burt Reynolds: “The Best Little Whorehouse in Texas” (1982), “Stroker Ace” (1983) and “Cannonball Run II” (1984).
James Thurston Nabors was born on June 12, 1930, in Sylacauga , Ala., the third child and only son of Fred and Mavis Nabors. His father was a police officer. Jim sang in his school glee club and church choir and played the clarinet in the school band.
After earning a degree in business from the University of Alabama, he moved to New York, where he worked as a typist at the United Nations while harboring hopes for a stage career. Those hopes went unfulfilled.
He then moved to Tennessee, where he worked as a film cutter for a Chattanooga television station. By the end of the 1950s he had moved to Los Angeles, partly to relieve his chronic asthma.
Taking a job as a film cutter at NBC, he started to perform, for no pay, at the Horn, a cabaret in Santa Monica, where his hillbilly monologues and operatic arias caught the notice of the comic actor Bill Dana, a regular performer on “The Steve Allen Show.” Invited by Mr. Dana to audition, Mr. Nabors was soon making frequent appearances on the Allen show as it neared the end of its long run. (It was canceled in 1961.)
Mr. Griffith also caught his act and decided that Mr. Nabors’s nasal twang and down-home ways made him a natural for “The Andy Griffith Show.”
“Andy saw me, and he said, ‘I don’t know what you do, but you do it very well,’ ” Mr. Nabors once recalled.
He spent much of his later years in Hawaii, where he had a home in Honolulu and a 500-acre farm in Hana, on the island of Maui, growing macadamia nuts and tropical flowers. He also had a home in Montana.
Mr. Nabors married Mr. Cadwallader, his companion of 38 years, in January 2013 at a hotel in Seattle, a few weeks after same-sex marriage became legal in Washington State. Although he was quoted at the time as saying that he had “never made a huge secret” of his homosexuality, and that people in the entertainment industry had long known he was gay, he had not publicly acknowledged it until his marriage.
Mr. Nabors told the television news operation Hawaii News Now at the time that before the marriage it had been been “pretty obvious that we had no rights as a couple.”
“Yet when you’ve been together 38 years, I think something’s got to happen there, you’ve got to solidify something,” he said. “And at my age, it’s probably the best thing to do.”
Mr. Nabors was 82 at the time and Mr. Cadwallader was “in his 60s,” he said. They met in 1975 when Mr. Cadwallader was a Honolulu fire fighter. He later went to work for Mr. Nabors, and they began a relationship, Mr. Nabors said. A niece and a nephew also survive him.
The Gomer Pyle persona never left Mr. Nabors, but he was comfortable with that.
“I’ve never found doing Gomer to be that limiting to me,” Mr. Nabors said in 1990. “I’ve always enjoyed the character, and I see no reason to change it.”
The Marines have recognized the character, calling Mr. Nabors “a great American.” In 2001, in a whimsical ceremony in Honolulu presided over by Gen. James L. Jones Jr., commandant of the Marine Corps, Pfc. Gomer Pyle — Mr. Nabors, in character — was promoted to lance corporal.