Can you first answer:-
- Did you open it manually, or application tried to open it?
- What exactly you did to open the temrinal (used something like right click > terminal or CLI)?
- How did you try to install java (GUI or CLI?, If CLI, what commands used)?
Well, there could be many reason(s), but you need to provide little more details.
Also once invoke following cmd from any already opened terminal, and share the result:-
~$ gnome-terminal &