A hijacker pretended he had a Glock firearm while he attempted to seize a van owned by a tradesman, it is alleged.
Alan Brennan (20) was fought off by the worker, who managed to lock his car and flee into the house where he was working, gardai claimed.
The case against Brennan was adjourned after a judge decided it was too serious to be dealt with in Dublin District Court.
Brennan, of New Street Gardens, Dublin 8, is accused of attempting to take control of a vehicle at Camac Terrace, Kilmainham, on October 14 last.
State solicitor Aisling Kelly told the court the alleged victim called gardai on the date in question and reported the incident.
He said that he had pulled up in his van outside the address where he intended carrying out some work when the defendant approached him.
"Mr Brennan attempted to hijack the van by grabbing him by the shoulder and telling him he had a Glock. He told him to give him the van and at that stage (the alleged victim) couldn't see if he had a gun in his hand", Ms Kelly said.
The man was scared but told the defendant to "f*** off" and kicked him out of his van, Ms Kelly said. It was alleged when the gardai were called, the accused maintained he was just attempting to sleep in the van overnight.
Asked how seriously the workman had taken the alleged threat, a garda replied: "He believed there was a chance (the accused) may have had a gun, but he believed there was more of a chance that he didn't."
No gun was produced in the incident. Judge Ann Watkin adjourned the case for the preparation of a book of evidence.