It is working now! I get the sound through the speakers connected to
the back port, and if I plug in the headphones on the front port the
sound to the speakers stops and I get sound in the headphones, as
normal in Pulseaudio and Windows. I have no idea why it started
working. Yesterday I spent hours trying unsuccessfully to make it
work. I tried an alsa tool called hdajackretask. This messed up the
sound card on the motherboard and I had to reboot the computer - as
suggested in the documentation for the tool. Maybe the reboot fixed
something in Jack.
Anyway, this issue is solved and I am very much enjoying the Jack
sound which has a crystalline clearness that Pulse lacks! Now that it
works on the desktop I will configure my new Thinkpad laptop the same
way.
Thanks a lot to all the Jack developers! :)