Clueless re Java: /opt vs. /usr/local

It seems this is a oft debated item, that's over my head.

So here's what I've got:
Java 7 set up at /opt/ but I really want it at /usr/local...

What have I done?

Have: Debian 7 (whezzy) with gnome, so what do I do to set things back where it should be?

I guess this is a hot topic according to these two who made some good points....I'm having issue getting Hadoop happy bc I followed the /opt path for Java and I think /usr/local is what it's looking for...

http://m.linuxjournal.com/magazine/pointcounterpoint-opt-vs-usrlocal

---------- Post updated at 02:59 PM ---------- Previous update was at 12:04 PM ----------

Think I got it, just needed to set the PATH

Can now run jps:)

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.

bakunin

A word of caution regarding the FHS. It is quite an old document. Many distributions, led by Fedora, are moving away from this standard as far as /usr/bin, /bin, /usr/sbin, /sbin and other OS-specifc directories are concerned.

However the intended purpose for /usr/local and /opt has not changed over the years.

As an addition to Buknin's post /opt is considered as "static" (vs dynamic ) and so any data variable or dynamic files for the application's configuration etc should be played in /var/opt/<app-name>, it has its importance if you have limited time frame for e.g. backups, you know that what is important to you on a daily basis check is in /var/opt for all your applications which should be save with your data...