The attack in Tripoli damaged an apartment building next to the Corinthia Hotel, a popular spot with international journalists that the government partially owns. Prime Minister Ali Zidan has an apartment in the hotel's upper floors.
The rocket launcher was attached to a vehicle, which erupted in flames after the grenade was fired.
The military official, who spoke on condition of anonymity in line with regulations, said the rocket was fired remotely and that no one was in the vehicle at the time of the attack.
The attack took place less than three kilometres from the high rise that houses the Canadian embassy.
No one was in the embassy at the time, and all staff are safe and accounted for, said Emma Welford, a spokeswoman for Foreign Affairs in Ottawa.
"We take the safety and security of our personnel abroad very seriously. We are monitoring events closely and taking appropriate security measures," she said.
A proliferation of weapons and armed gangs after the 2011 civil war that overthrew dictator Moammar Gadhafi continues to threaten the country's security. Libya's government has struggled to bring armed militias under control and continues to rely on them for security.
Zidan has angered some militia groups by vowing to restore the authority of the state and disband armed groups that he says are "hijacking" the country. Zidan has faced threats from armed groups who besieged him in his office earlier this year over remarks he made threatening to summon outside help to confront militias. Shortly after that, his chief of staff was abducted and released days later.
Earlier Tuesday, a bomb was thrown at a police station in the eastern city of Benghazi, wounding three detainees held there, security officials said. A bomb exploded Monday at a courthouse complex in Gadhafi's hometown of Sirte, wounding a soldier.Suggest a correction