The use of a lamp by Jim in the movie is a change from the book on which it is based. In the book, Jim sees a Japanese launch try to get the attention of American and British vessels. Then he sees the launch communicating with a Japanese gunboat using signal lamps. He thought the Japanese were trying to sell something to the British or the Americans, and he knew the American officers were not aboard the USS Wake, and that the Japanese were wasting their time. "Standing against the window with his arms outstretched, he tried to remember the semaphore he had learned in the cubs." (p 27) Presumably, he was trying to communicate to them what he knew using semaphore (an alphabetic code consisting of arm positions, often done with flags to communicate ship to ship).
In the movie, Jim communicated with a lamp, and so he would have been using Morse code (what he could remember of it). When guns started exploding, Jim thought he had mistakenly started the war with his poor communication: "Jim watched them somberly. He realized that he himself had probably started the war, with his confused semaphores from the window that the Japanese officers in the motor launch had misinterpreted." (p 28)
The Japanese have their own version of Morse code which they used in the war, called wabun code. Each symbol in wabun code maps to a kana, or Japanese syllable. "Wabun Code was famously used to transmit the message "NIITAKA-YAMA NOBORE 12 08" on December 2, 1941, signalling the go-ahead of the Japanese attack on Pearl Harbor." (Wikipedia)
The screenplay was primarily written by Tom Stoppard, with collaboration from the book's author, J.G. Ballard. It is hard to imagine that Ballard would have wanted to make Jamie's message more explicit in the movie than it was in the book, but I have not been able to find a copy script to verify this.