one liner to extract path from PATH variable

Hi,

Could anyone help me in writing a single line code by either using (sed, awk, perl or whatever) to extract a specific path from the PATH environment variable?

for eg: suppose the PATH is being set as follows

PATH=/usr/bin/:/usr/local/bin:/bin:/usr/sbin:/usr/bin/java:/usr/bin/perl3.4

I need to check whether the string "java" is there (consider "java" appears exactly one time for the time being), if it does exist I need to extract the path "/usr/bin/java".

Note: java path may appear at any position (i.e) it may be the first or the last path or appear in middle of the PATH setting. So my code should be efficient in handling all these

If you have grep -o:

echo "$PATH"|grep -o "[^:]*java[^:]*"

-or-

echo "$PATH"|awk /java/ RS=":"
echo "PATH=/usr/bin/javax:/usr/local/bin:/bin:/usr/sbin:/usr/bin/java:/usr/bin/perl3.4" | \
awk '{sub("PATH=",X)}/java/' RS=":"