When Chinese President Xi Jinping visited the White House earlier this month, President Trump offered him better trade relations in return for China’s help in stopping North Korea’s nuclear weapon and ballistic missile programs.

Mr. Trump believes China will do what he wishes. Yesterday morning — referring to his campaign promise to label China as a currency manipulator — the president tweeted, “Why would I call China a currency manipulator when they are working with us on the North Korean problem? We will see what happens!”

We will, indeed. For all of Mr. Trump’s wheeling and dealing skills, this time, he’s going to be bitterly disappointed. There are myriad reasons why China won’t (and probably can’t) stop the man Sen. John McCain referred to as a “crazy fat kid” from continuing his rush to develop or otherwise acquire nuclear weapons and the means of delivering them as far as the United States.

Despite Mr. McCain’s heroism in Vietnam (which Mr. Trump was wrong to deny), his track record in politics is such that the last occasion on which he was right doesn’t reside in living memory. Kim Jong-un is young and fat but not crazy in the context of his regime. It’s an oppressive military dictatorship that sustains its credibility among its own military with a belligerent nationalism.

North Korea’s belligerence is demonstrated almost daily in speeches and “reports” by its state-controlled media. They make threats so often, it’s hard to keep track of them.

On Saturday, North Korea celebrated the 105th anniversary of the birth of Kim Il-sung — the brutal dictator whose grandson, Kim Jong-un, is the current version of him — with a massive military parade. Thousands of goose-stepping troops paraded along with dozens of what appeared to be missiles.

People more expert in this than I have proclaimed the parade was of missile containers not the missiles themselves. Some appeared to be the real thing, ranging from short-range crude “Scuds” to missiles of the form associated with those that can be launched from submarines. Sub-launched ballistic missiles are evidently a top priority for the Norks.

The missile containers in the form of longer-range ICBMs, possibly capable of hitting the U.S., were almost certainly either empty canisters or filled with prototype missiles.

The belligerence was on display again a day later, when the Norks launched a missile from an eastern base. It exploded just after launch. Malcolm Rifkind, former British foreign minister, said the explosion may have resulted from a U.S. cyber-attack on the missile launch of a kind that has occurred before. Let’s hope he is right.

Just after the big parade, one of the Nork news agencies, KCNA, “reported” that the Trump administration’s “serious military hysteria” had entered a “dangerous phase that can no longer be overlooked.” It added, “Under the prevailing grave situation, the United States has to come to its senses and make (sic) a proper option for the solution of the problem.”

This should look familiar to anyone who has paid any attention to North Korea in the past three decades. This is the same stunt they pulled more than 20 years ago. Then, they made a lot of threats near the beginning of their nuclear weapons program. The threats were enough to sucker President Clinton into the 1994 so-called “Agreed Framework” deal that offered North Korea light water nuclear reactors (and other supplies to sustain the regime) if they shut down their nuclear weapons program. In October 2006, the Norks exploded their first nuclear test weapon.

Now they are trying to blackmail us again, threatening us in order to get us to bribe them again. Mr. Trump isn’t falling for this, at least not yet. But he apparently believes he can maneuver the Chinese into helping us. It’s a really bad bet.

China’s attitudes toward North Korea have always been separated between what they tell us and what they do. China supposedly cut off (or at least reduced) coal imports from North Korea last year. But the latest reports show that overall trade has increased between the two nations by more than 37 percent in just the first quarter of 2017. China isn’t going to do a bloody thing to help us “solve” North Korea’s nuclear and missile challenges.

Moreover, China has been helping North Korea develop its ICBMs. In February 2016, the Norks launched a satellite into space in a clear test of the range and capacity of its “Kwangmyongsong-4” missile. Parts of the launch vehicle recovered from the Yellow Sea revealed that many critical components had been manufactured in China by several Chinese businesses. They could not have supplied them to the North Koreans, without government approval.

But it was more than that. The Chinese government was actively helping the Norks develop a missile capable of hitting the U.S. mainland. President Trump is considering new sanctions on some North Korean officials and interests. He won’t sanction those Chinese companies, while he believes China is going to help us solve the North Korean problem. That’s a big mistake.

And it gets worse.

For years, U.S. intelligence agencies have known that Iran was helping North Korea develop its nuclear weapon and missile capabilities. Since Obama’s misbegotten “Joint Comprehensive Plan of Action” — his extraordinarily dangerous missile deal with Iran — both Iran and the International Atomic Energy Agency (the U.N.’s purblind nuclear watchdog) have said Iran isn’t cheating on the JCPOA. (The IAEA has declared some violations by Iran, such as retaining possession of more “heavy water” and enriched uranium than it is entitled to, but nobody’s squawking so far.) We need to remember that China, as one of the five permanent members of the U.N. Security Council, played a significant role in pushing Obama’s JCPOA both in negotiations and in getting the U.N.’s blessing for it, which (thanks to Tennessee Sen. Bob Corker) Obama was able to substitute for Senate ratification.

Last month, CENTCOM commander Gen. Joseph Votel told the House Armed Services Committee that Iran’s behavior hasn’t improved since the JCPOA was signed. He told the HASC that, “Unfortunately, the [nuclear] agreement has led some to believe that we have largely addressed the Iranian problem set and that is not the case. In addition to its nuclear weapons potential, Iran presents several credible threats. They have a robust theater ballistic missile program, and we remain concerned about their cyber and maritime activities, as well as the activities of Iran’s Islamic Revolutionary Guard Corps — Qods Forces and their network of [terrorist] affiliates.”

Anyone who’s been paying attention since 1979 knows that the Iranians are cheating on their obligations under the JCPOA consistently. What better place to do so than in North Korea, where the IAEA never sets foot? You can bet the ranch that the Iranians and the Norks are working together in North Korea and wherever they can hide from IAEA in Iran to develop jointly the nuclear weapons they both so desperately want.

Airliners and military aircraft can fly from either country to the other (with convenient stops in China), carrying people and technology. There’s even monthly train service between China and Tehran to carry things too heavy or bulky (missiles are both) to ship by air. According to the Chinese Xinhua news agency, the first train left China on January 28, 2016, and arrived in Tehran about two weeks later.

Secretary of State Rex Tillerson warned North Korea and China that our “strategic patience” toward North Korea was at an end. In preparation for North Korean missile launches and nuclear tests, which were thought to be planned to coincide with Saturday’s parade, the president ordered the nuclear carrier USS Carl Vinson and its battle group close to North Korea.

It’s no secret that part of the standard equipment of our carriers are nuclear weapons. The battle group also has a large quantity of both ship-launched Tomahawk cruise missiles and SM-3 anti-missile missiles.

Mr. Trump’s thought to impose more sanctions on the North Koreans will quickly be found to have no effect on the Norks’ nukes and missiles. He can wait — briefly — for the inevitable failure of China to rein in North Korea. They have no reason to do so and may not be able.

So what can the president do? If Malcolm Rifkind is right about our ability to use cyber-attacks to thwart North Korean missile launches, those cyber operations should be increased and used, if possible, to disrupt their nuclear tests. If he’s wrong, we should develop and use those capabilities as soon as possible. Those covert efforts have to be backed up by the readiness to use force in certain circumstances.

President Trump doesn’t want to start what could be a big war on the Korean Peninsula. Nuclear weapons could be used by the Norks, and once that threshold has been crossed, it’s impossible to get back behind it.

On the other hand, some North Korean actions have to be answered with military force, if they cannot be deterred. If the Norks launch missiles aimed at Japan or American territories such as Alaska or Hawaii, we’ll know within seconds. Those missiles can and must be shot down, before they have a chance to reach their targets.

That leaves the enormous problem of Iranian-North Korean cooperation in developing nuclear weapons and ICBMs. Neither China (which has been helping Iran build nuclear reactors) nor Russia (which has been doing the same and has partnered with Iran in establishing their joint massive military presence in Syria) is going to do anything to solve that problem.

No one can reasonably believe that Iran or North Korea can be peacefully disarmed of nuclear weapons or ICBMs.

Mr. Trump hasn’t tried to renegotiate the JCPOA with Iran as he promised to in his campaign. Iran won’t agree to any changes, and both China and Russia will block a renegotiation. Mr. Trump would be wise to try, fail, and then cancel the agreement.

The president can begin to rebuild our military in a manner that will enable it to deter — with a much larger anti-missile defense network — any attack using ICBMs against us or our allies. North Korea may be susceptible to deterrence, but, as I’ve written before, Iran isn’t.

At this point, there’s little else Mr. Trump can do.