Balling the jack is best known as the name of a dance from the Dixieland heyday around 1913.
"First you put your two knees close up tight
Then you sway them to the left, then you sway them to the right
Step around the floor kind of nice and light
Then you twist around and twist around with all your might,
Stretch your loving arms straight out into space,
Then you do the Eagle Rock with style and grace.
Swing your foot way 'round then bring it back.
Now that's what I call Ballin' the Jack."
Later it was expanded to mean just dancing in general or just having a good time.
It also means risking everything on one attempt. At slangcity.com a reader had this to say about the "risk" meaning:
"To "ball" a "jack" refers possibly to the action of risking a shot in "Boules", or Bocce or its sister game Petanque. The jack in either case is the smaller ball for which the goal of the game is to either throw your team's ball closest to it, or to knock away your opponent's ball. To hit the target ball to another location, or to "ball the jack", is to alter the focus of the gameplay. To do so requires great accuracy, and assuming the game is scored for money instead of points (it is a drinking game, and takes skill and a bit of luck as well), takes risk as well, for in double or triple team play, you only get one shot (one ball per player). So to "ball the jack" is to risk a miss, and a wasted shot, at something that is really important to you."
It is also a term used by railroad men. Hobart Smith does a song with the lines "Balling the jack, lining track / You can't shovel no more" and the liner notes say it comes from railroad section gangs in the early 1870's. To fix a crooked rail you had one person sit on the track and site along it to see where it needed to be straightened (lining the track), then two men would put jacks at an angle against the inside ball of the rail and lever it until it was straight. Then you had to shovel ballast back in under the ties and tamp it down. The ball of the rail is the curved part going up to the flattened surface on top of the rail. The jack had a groove across the top that fit against the ball so it wouldn't slip off.
It has also been used as a euphemism for sexual intercourse in some jazz and blues lyrics.