Linux: Redirecting output of a command to "find"

view story

http://stackoverflow.com – I have a list of file names as output of certain command. I need to find each of these files in a given directory. I tried following command: ls -R /home/ABC/testDir/ | grep "\.java" | xargs find /home/ABC/someAnotherDir -iname But it is giving me following error: find: paths must precede expression: XYZ.java What would be the right way to do it? (HowTos)