James Lawrence was born in Burlington, New Jersey, in 1781. His family were persons of consideration and property, and Lawrence was destined to be a lawyer. He was a remarkably handsome, gentle, and docile boy, and it was a surprise to his family when, at twelve years of age, he developed a passionate desire to enter the newly created navy. He never wavered from this wish, but, being a singularly obedient boy, he agreed to try the study of the law for a time, and applied himself seriously to it for a year or two. In 1798, however, when he was in his eighteenth year, and when his natural bent was fully indicated, his inclination toward the navy became overpowering. His family wisely released him from the law, which was so distasteful to him, and got him a midshipman's warrant in the navy.

His first service was in the Ganges, a small twenty-four-gun frigate. At the time of his entrance into the navy he was of a noble and commanding figure, of captivating manners, and although somewhat impatient in temper, at heart entirely amiable and generous. From the beginning he was remarkable for his kindness and consideration toward his inferiors. When it was necessary to punish the sailors, and Lawrence had to superintend the punishment, his eyes would fill with tears; and when he became a lieutenant, his popularity with the midshipmen was unbounded. It is told of him that once the midshipmen in Commodore Rodgers's squadron determined to give the commodore a dinner, to which none of the lieutenants were to be invited. All were agreed to leave out the lieutenants, when one of the midshipmen cried, "What! not ask Mr. Lawrence!" The impossibility of leaving Lawrence out seemed patent to all of them; and to make the compliment more marked, he was the only lieutenant asked to meet the commodore.

Lawrence's first service in the Ganges was during the troubles with France. The Ganges patrolled the seas, and caught several French privateers which made a good resistance, but never got alongside a vessel of equal force.

In 1802 Lawrence went out to the Mediterranean in the Enterprise, as first lieutenant. This gallant little schooner fully sustained her reputation in the operations of Commodore Morris's squadron, which preceded Commodore Preble's by a year. Although the war had just begun, and had not yet assumed the fierce and determined character of the following year, yet the Bashaw had a foretaste in 1803 of what was to befall him in the way of bombardments and boat attacks in 1804. In one of the boat attacks Lawrence volunteered, and his conduct on the occasion won high praise.

The force was under the command of Lieutenant David Porter, first lieutenant of the New York, flagship, who had already distinguished himself against the French, and was destined to make one of the most daring cruises in the history of navies.

The New York, with the Adams, frigate, and the little Enterprise, began the blockade of Tripoli in May, 1803. A number of merchant vessels, protected by gunboats, ran under the batteries of the old part of the town, where they were comparatively safe from ships of the draught of the American squadron. Every preparation was made to defend them, but Porter, Lawrence, and other brave and daring young spirits determined to make a dash for them and destroy them if possible. Having got the commodore's permission, an attacking party was organized under Porter, with Lawrence as second in command, with three other officers and a number of picked men. On the morning of the attack the boats advanced boldly, in the face of a sharp musketry fire, and succeeded in making a landing. The Tripolitans adopted their usual style of hand-to-hand fighting, but in spite of it the vessels were fired and the Americans retired with slight loss. The Tripolitans, by the most tremendous efforts, put out the fire and saved their vessels; but they discovered that the Americans were disposed to come to close quarters with them, which policy finally brought down the power of the Barbary States.

Lawrence, as well as Porter, was particularly distinguished in this dashing little affair. The next adventure in which Lawrence was engaged was a few weeks after; the Enterprise being under the command of Hull, then a lieutenant commandant. It had been determined to hunt up the Tripolitan ships of war wherever found. The Enterprise was engaged in this service, and on a June morning, very early, the lookouts from the Adams, frigate, observed a signal flying from the Enterprise of "Enemy in sight." A Tripolitan frigate, supported by nine gunboats, trying to get to sea from Tripoli, had been penned up in a narrow bay by the Enterprise, which, too weak to attack, signalled for her more powerful consort to come to her assistance. The Adams responded promptly, the Enterprise meanwhile maintaining her station with as much daring as if she were a forty-four-gun frigate instead of a twelve-gun schooner. As soon as the wind permitted the Adams to get within range, she opened with terrible effect upon the corsair, which replied vigorously, and did not strike until she had received the fire of the Adams, in smooth water and at short range, for three quarters of an hour. Soon after her colors were hauled down, fire reached her magazine, and she blew up.

It was Lawrence's extreme good fortune, after serving under such a captain as Isaac Hull, to serve next under Decatur. The Argus, one of the four handsome little vessels built for the war with Tripoli, had been sent out under Decatur, who was to exchange her for the Enterprise, Hull's superior rank entitling him to the larger vessel. Yet it is remarkable that the little Enterprise, although distinctly inferior to the other four small vessels, survived every one of them, and had an unbroken career of success both in running and fighting.

As soon as Decatur took the Enterprise, and had got a good look at Tripoli on the reconnoitring expedition made by Commodore Preble in the early winter of 1803, the idea of the destruction of the Philadelphia and the release of Bainbridge and his companions possessed his mind. It may be imagined that Lawrence ardently sympathized with him, and in his young first lieutenant Decatur recognized a daring and steadfast spirit akin to his own. It was Decatur's habit, in speaking of Lawrence, to say, "He has no more dodge in him than the mainmast," which was true.

In the same month of December the Enterprise captured the ketch Meshouda, which, renamed the Intrepid, was to take part in one of the most glorious successes, and afterward in one of the most heart-breaking tragedies, of the American navy.