I would take the train to Penn Station (NYC midtown).
From there you can:
a) take a taxi - $45 flat rate up to four passengers to JFK.
b)take LIRR (Long Island RailRoad) to Jamaica Station, and take then the AirTrain to whatever JFK terminal your airline is located (it goes in a circle to all of them). This option is much cheaper than option A. And of course, depending of day and time, even faster.
Metropark (NJ) to JFK