After 75 years of peace, Japan is facing immense challenges in its rush to build a more formidable military. To understand why, consider the Noshiro, a newly commissioned navy frigate equipped with anti-ship missiles and submarine-tracking sonar.

The vessel was designed with an understaffed force in mind: It can function with about two-thirds of the crew needed to operate a predecessor model. Right now, it puts out to sea with even fewer sailors than that.

On the ship’s bridge, tasks that previously occupied seven or eight crew members have been consolidated into using three or four. The ship’s nurse doubles as dishwasher and cook. Extra sprinklers were installed to compensate for the smaller staff onboard to fight fires at sea.

“We are systematizing a lot of things,” Capt. Yoshihiro Iwata, 44, said when the frigate was docked recently in Sasebo, in southwestern Japan. “But, to be honest,” he added, “one person is doing two or three different jobs.”

The slimmed-down crew on the Noshiro nods to the stark demographic reality in Japan as it confronts its gravest security threats in decades from China’s increasingly provocative military actions and North Korea’s growing nuclear arsenal.

Japan has committed to raising military spending to 2 percent of gross domestic product, or by about 60 percent, over the next five years, which would give it the third-largest defense budget in the world. It is rapidly acquiring Tomahawk missiles and has spent about $30 million on ballistic missile defense systems.

But as the population rapidly ages and shrinks — nearly a third of Japanese people are over 65, and births fell to a record low last year — experts worry that the military simply won’t be able to staff traditional fleets and squadrons.

The army, navy and air force have failed to reach recruitment targets for years, and the number of active personnel — about 247,000 — is nearly 10 percent lower than it was in 1990.

Even as Japan struggles to recruit conventional troops, it must also attract new battalions of technologically savvy soldiers to operate sophisticated equipment or protect against cyberattacks. For some tasks, military leaders say they can turn to unmanned systems like drones, but such technology can still require large numbers of personnel to operate.

The demographic challenges pose economic ones, too: There is strong public resistance to tax increases to fund the defense budget at a time of rising social costs for older people.

“The budget itself cannot defend the country,” said Yoji Koda, a retired vice admiral. “The fundamental thing is how to recruit,” he added. “That means thinking about how to wake the kind of sleeping Japanese community up.”

With the United States stretched thin by the wars in Ukraine and Gaza as well as growing competition with China, it needs Japan to become a more equal partner. Since the end of World War II, Japan, which hosts more American troops than any other nation, has effectively been a protectorate of the United States.

So far, American political and military leaders have spoken approvingly of Japan’s defense progress, hailing its budgetary expansion and new investments in military hardware. “It brings credibility to deterrence,” said Rahm Emanuel, the U.S. ambassador to Japan.

To demonstrate closer coordination, the two nations have expanded and accelerated military exercises.

Last summer, during the largest-ever edition of Resolute Dragon, an annual bilateral exercise, the U.S. Marines and the Japanese military conducted operations “side by side,” said Lt. Gen. James W. Bierman, the commander of the Third Marine Expeditionary Force on Okinawa.

The idea is to train with Japanese troops so that “we can truly swap out one platform or capacity from one nation for another,” said Rear Adm. Christopher D. Stone, commander of Expeditionary Strike Group Seven in Okinawa.

The tighter relationship comes as the Japanese public’s view of the military has evolved.

The country has pacifism written into its Constitution, and, until recently, the public opposed the acquisition of missiles capable of striking enemy territory or legal changes that would allow Japanese troops, restricted by the Constitution to defense of the nation, to fight in some combat situations outside Japan. Now, as much of the population sees China as a threat to Japan’s security, polls show support for such measures.

That, however, has not translated into a surge in enlistment to Japan’s Self-Defense Forces, as the military is known.

“The societal acceptance of the S.D.F. is much wider and deeper” than in the past, said Ayumi Teraoka, a postdoctoral research scholar at Columbia University’s Weatherhead East Asian Institute. “But that doesn’t translate to ‘OK, let’s send our kids to the S.D.F.’”

Gen. Yoshihide Yoshida, chairman of Japan’s joint staff, acknowledged the challenges in an interview at the Ministry of Defense in Tokyo. “We are facing huge struggles in recruiting,” he said, adding that “it’s not enough to just do what we have been doing,” given how quickly Japan wants to implement its ambitious goals.

To expand the overall ranks, General Yoshida said the Self-Defense Forces should increase the proportion of women to 12 percent, from less than 8 percent, by 2030. The military must recruit midcareer officers, collaborate with the private sector, and deploy artificial intelligence and unmanned systems, he said.

The hurdles are high. Accounts of sexual harassment in the military discourage women from enlisting. With the unemployment rate at 2.5 percent, luring new graduates or job changers is difficult.

“In the past, people came to the Self-Defense Forces because they had no other choices,” said Col. Toshiyuki Aso, director of recruitment at a military center in Naha, the capital of Okinawa. “Now they have many more choices.”

Posters aimed at drawing in women and older recruits papered the walls of the center, in a drab office building on a side street. “Protect people, it’s so rewarding,” read one slogan underneath a photograph of a female soldier. “A future to be proud of, even after retirement,” read another targeting prospective reserve officers. “It’s not over yet!”

A recent drill on a base in Naha revealed the labor demands of even mundane tasks: 90 troops assembled on a 50-yard-long concrete slab to practice repairing a runway after a hypothetical enemy attack. Over nearly three hours, they bulldozed piles of rubble and tamped down dirt with teeth-rattling soil compaction rammers.

The troops completed their duties with artisanal care, smoothing newly laid concrete with hand trowels and sweeping away cement dust with small brushes.

Sheer numbers aside, experts say the modern military will demand higher-level skills to operate advanced weaponry and surveillance equipment. Already, Japan lags its allies in protecting against cyberwarfare.

“There is no military structure to defend Japanese citizens against cyberattacks,” said Hideto Tomabechi, a computer scientist who has advised Japan’s Self-Defense Forces and is a fellow at Carnegie Mellon University in Pittsburgh.

The government has said it plans to expand its military cyberforce to as many as 4,000 people, although many Japanese are leery of cybersecurity operations they believe could invade their privacy.

“There is a lot of worry that the government will be able to check on all private citizens’ emails and information and Web searches,” said Itsunori Onodera, a former defense minister.

To make military service more appealing, General Yoshida said the Self-Defense Forces needed to offer higher salaries or better living quarters. Naval recruiters have trouble attracting sailors, for instance, because young prospects worry about being cut off from Wi-Fi at sea. American sailors, by contrast, can access social media on their phones and even receive deliveries from Amazon onboard.

Some recruitment tactics have fallen flat. Seeking to emulate the “Be All You Can Be” ads familiar to American moviegoers, the Self-Defense Forces aired ads in theaters last summer before showings of “The Silent Service,” a thriller set on a nuclear submarine.

Asked if the advertisements had inspired new enlistments, Hironori Ogihara, a spokesman at the Okinawa recruiting center, grinned with a what-can-you-do shrug.

“Not yet,” he said.