The debate about "/opt" versus "/usr/local" boils down to the following:
In Unix the layout of the filesystem is more or less fixed. Every file, executable or not, should have its designated place where it has to go. This only as an afore.
The Linux initiative came up with an attempt to further codify this already long-used "best practice" and published the "Filesystem Hierarchy Standard"
I won't comment on the other parts of the document, just the part dealing with "/usr/local" and "/opt":
"/opt" is where all application should go. For every application there should be a subdirectory with its name (and optionally manufacturer) and in that a directory with its version. The "foo" application of the "bar" company in version 1.23 would go to "/opt/bar/foo/1.23", for instance. The executables for this software should be in "/opt/bar/foo/1.23/bin" with optional links to "/opt/bin" to avoid a convoluted PATH.
"/usr/local" is the place for all the OS extensions the administrator wants to have at this particular system. As "/usr" (short for "Unix Software Resources") is under the sole discretion of the OS provider this is the only place that should be modifyable by the SysAdmin. Still, this should be limited to OS-relevant utilities
, not for applications in their own right. You might place a third-party "ssh"-client there or "gzip", but not, for instance, "MySQL".
Having said that: if you put java into "/usr/local" or into "/opt" is a question of if you see it as an application in its own right or merely a system tool. There is no "correct" answer to that, just your sensible decision about what best describes its usage on your system.
I hope this helps.