OK, so we're on the right track as far as using Traffic Rules rather than Program Rules: you certainly don't want to open that port to all Java code!
We could, theoretically, restrict the rule we create to only that one computer--given your circumstances--but unless you have a fixed IP address for it (unlikely) that would amount to specifying the full range of IPs that it could be assigned...which would be the same thing as "Any computer in the local subnet." LOL
"Connections" should have been fine as "from" only: this doesn't refer to the directionality of the traffic, but rather to who's requesting the connection. For a server, it's the other computer asking the server for something, so it's the requestor. Of course in your case, the client and the server are the same physical computer, so since we're specifying this as a Traffic Rule, it's safer to say "to and from" as you now have, so let's leave it that way.
The default "locality" for the port when you add it is "remote" ...but in this case as you've now clarified it, it's the same computer, so let's try adding one for "local" instead; that may be the "localhost" it's looking for.
Finish the instructions out as before. When the rule has been added, make sure it's at the top of your list--otherwise it could be that some other rule that's a block rather than allow might come along and override it.
Let's leave it at that for now--unless you happen to know that it needs a protocol other than TCP or UDP, in which case you should use that instead when creating the rule above. Also, should you happen to know for sure that Apache is addressing the server using IPv6, you'll want to have checked the box that talks about applying this rule for Teredo on the screen that has the other box for creating a security log entry each time the rule gets applied.
Fingers crossed that this works; it's about the last thing that I can think of, given what you've reported.
V/R,
--DistEd2