How can I install a J-Trap for a bathroom sink with limited space?
Seems to me that the issue is the pipe enters the wall so low that the J-trap won't reach (and would hit the shelf)?  Looks like you are going to need to get two elbows, or a 180 and bring the wall fitting up higher to meet your J:



It will snake around a lot, but I don't think there's anything wrong with doing that.
BTW, since it's visible, I'd suggest getting chrome instead of the plastic.



EDIT: As mentioned in the comments below, the solution above is pretty easy, but will result in a more clog-prone drain since the water won't drain as fast, and there are more turns to clog up (and it will not snake easily).  The more difficult solution is to open the wall (hope the plumbing is plastic and not iron) and move the sanitary tee higher, and then patch the wall back up.