Place 'find' results within TeX command

Hi,

In an effort to collect all my .java-files and place them in a LaTeXfile (using the listings environment of latex), i tried to use ex.
So what i have now is:

find . -name "*\.java" > latex
ex latex <<HERE
%s/\(.*\)/\\lstinputlisting{\1}
wq
HERE

So i try to escape the '\' with another '\' but this doesn't work. So someone suggested me to use echo, which would be alot easier.

So i tried:

echo \lstinputlisting{$(find . -name "*/.java")}

But this wraps the 'lstinputlisting' around all the results together and not around each result individually.

Anyone has a suggestion ? I'd prefer to use echo, but i can't find how to use it properly to get the right outcome. So just need an echo command to wrap \lstinputlisting{} around every search result.

Use $\backslash$.

Help On LaTeX Special Characters