Charles Napier, a character actor who portrayed ruffians, military officers and other strong men in films like the second Rambo movie, but who played against type as a judge in “Philadelphia,” died on Wednesday in Bakersfield, Calif. He was 75.

His death was confirmed by his agency, Bauman, Redanty & Shaul.

Mr. Napier also had an active career on television. One role, which has become something of a camp classic among fans of the 1960s “Star Trek” series, was as a space age hippie musician who comes aboard the Starship Enterprise with a group of others like him and sings and strums a futuristic guitar.