Asked by a reporter at a photo op whether he had lost faith in Beijing, Trump replied: "Never give up." But he did not respond to a follow-up question about whether he has been disappointed in China's inability to constrain North Korean ruler Kim Jong Un.
Earlier in the day, during a news conference in Warsaw before his arrival in Germany, Trump called North Korea's successful test of an intercontinental ballistic missile "very, very bad behavior."
"Something will have to be done about it," he said, though he did not offer details about what responses his administration was considering.
The Trump administration's effort to forge consensus among members of the U.N. Security Council appears to have hit a wall, given the opposition in Moscow and Beijing to additional economic sanctions or potential U.S. military actions against Pyongyang.
New sanctions would have little effect unless backed by China, which is North Korea's financial lifeline.
Trump had a 75-minute meeting with South Korean President Moon Jae-in and Japanese Prime Minister Shinzo Abe in a bid to put the two U.S. allies on the same page as Washington. Norio Maruyama, a Japanese government spokesman, told reporters in Hamburg that the conversation was "very vivid" and that the only topic on the agenda was North Korea.
The three leaders agreed that China should do more to rein in North Korea's "provocative" behavior, Maruyama said. Abe emphasized that "holding dialogue for the sake of dialogue with North Korea is meaningless," Maruyama said. He added that the Japanese leader believes that "it would be essential to put pressure on North Korea to make it engage in dialogue seriously."
Maruyama said the issue of military action was not discussed with any specificity.
"Great trilateral meeting & dinner," Trump wrote on Twitter, including a photo of him flanked by Moon and Abe. U.S. Secretary of State Rex Tillerson attended the meeting with Trump, along with other U.S. officials.
Their discussion came a day before Trump was to hold his first bilateral meeting with Russian President Vladimir Putin, on Friday in Hamburg. Trump is expected to meet with Chinese President Xi Jinping on Saturday.
Defense Secretary Jim Mattis told reporters at the Pentagon on Thursday that the launch of the ICBM does not alone bring the United States closer to war. Mattis described ongoing efforts to pressure North Korea as "purely diplomatically led" with a focus on economic sanctions.
"Diplomacy has not failed," Mattis said. It is U.S. self-restraint that has prevented "war in the face of provocations," he said, "but our self-restraint holds, and diplomatic efforts remain underway as we speak."
Mattis said the United States is still analyzing the reentry vehicle in the ICBM launched this week. U.S. defense against North Korean missiles are sufficient, and the United States knew quickly that the missile had been launched, he said.
"We assume these sorts of things from him," Mattis said of North Korea's leader. "We were on duty. As you all know, the radars were up and operating."
Pentagon officials this week have sought to underscore that the ICBM threat posed by North Korea is "nascent" and that Pyongyang has a long way to go in terms of understanding the trajectory of the missiles and reentry before they could hit North America.
While the Trump administration has said that all options are on the table to counter North Korea, Mattis has previously warned that an armed conflict would include "probably the worst kind of fighting in most people's lifetime," citing the threat posed by hundreds of North Korean rocket launchers and artillery pieces aimed at Seoul.
The Pentagon and State Department have not taken steps that would indicate U.S. officials are seriously concerned that the situation is an immediate crisis, such as sending home the families of U.S. service members and State Department employees stationed in South Korea.
At an emergency meeting of the U.N. Security Council on Wednesday, U.S. Ambassador Nikki Haley accused China and Russia of "holding the hands" of the North Korean leader.
Her words were met with criticism from Vladimir Safronkov, Russia's deputy ambassador to the United Nations, who called stricter sanctions "not acceptable" and military action "inadmissible."
At a daily briefing in Beijing on Thursday, a spokesman for China's Foreign Ministry backed him up, calling for calm in response to U.S. remarks.
After his first meeting with Xi in April, Trump emerged professing confidence that China would pressure Pyongyang to stop testing nuclear weapons and ballistic missiles. That plan, as he recently tweeted, "has not worked out."
But U.S. tough talk seems unlikely to bring Beijing on its side, experts said.
The U.S. response to the ICBM test so far has encompassed joint military exercises with the South Koreans, calls for stricter sanctions on those doing business with North Korea and high-level warnings of military action — all of which are at odds with Chinese plans.
It's not that China does not care about the North Korean threat — it does — but that it sees it differently, analysts said.
Beijing and Pyongyang were once communist brothers-in-arms at war with American forces. Those days are long gone, but the memory of the 1950-1953 Korean War looms large.
The fact that thousands of U.S. troops are still stationed in South Korea is a sore point for the Chinese, which would rather not have the American military at their doorstep. Beijing often sees U.S. moves in South Korea, from joint exercises to missile defense, as maneuvers designed to counter Chinese military might.
Indeed, the "double suspension" plan pitched by China and Russia in the wake of the ICBM test calls for the United States and South Korea to suspend joint military exercises and for North Korea to freeze its nuclear and ballistic missile programs.
Over the years, Trump has said repeatedly that China is the key to squeezing the regime into submission. However, China does not appear willing to topple Kim.
"It's not very likely that China will follow the will of the U.S. and put a 'heavy move' on North Korea, like what President Trump has called for," said Deng Yuwen, a Beijing-based expert on North Korea.
"It would expand sanctions, but there is a bottom line, and the bottom line is that it won't sanction North Korea such that it causes chaos in the North," he added.
Lastly, Beijing does not have the same sense of urgency when it comes to North Korea. China has always been in reach of North Korea's military, so the development of an ICBM is not as much of a game-changer.
Plus, China's leadership remains focused on domestic issues, namely key political meetings set for the fall, said Michael Kovrig, a Beijing-based senior adviser for the International Crisis Group, and officials are unlikely to make any move that could threaten their bases of support.
"Chinese analysts continue to argue that no amount of pressure, short of what might cause a collapse, will bring North Korea to denuclearize," Kovrig said.
"Beijing's prescription is still to coax rather than to pressure. Unlike the U.S., it's not in a hurry and hopes that economic incentives can gradually induce Pyongyang to moderate its behavior."
Rauhala, Luna Lin and Shirley Feng reported from Beijing. David Nakamura and Dan Lamothe in Washington contributed to this report.