every Java program is infringing
No, for a couple reasons:
1. Those programs aren't distributing the material in question. You, the user, will have independently acquired the JRE. This will have most likely been through non-infringing means, given that Sun/Oracle lets you have it for free, and even if it were infringing, you'd be the one at fault, not the program author.
2. Even if that weren't true, there would still be a couple of options to create a non-infringing program. Only programs that are neither non-GPL, nor those from authors who have some other valid commercial license would be infringing. Not "every Java program".