Java does not open any ports. The system administrator does that. And you only need to open a port if an application you write in Java requires it. But guessing from your question you are not a Java developer at all, and you thought this was some kind of Java technical support forum.