* To answer the title of the question, since it is the first in google results (the output.txt problem is not actually related):
This is what I use to combine .jar
files to run a Java application with files in lib/
:
EntityManagerStoreImpl
ondra@lenovo :~/work/TOOLS/JawaBot/core$ ls catalog.xml nbactions.xml nb-configuration.xml pom.xml prepare.sh resources run.sh sql src target workdir ondra@lenovo :~/work/TOOLS/JawaBot/core$ echo `ls -1` | sed 's/\W/:/g' catalog:xml:nbactions:xml:nb:configuration:xml:pom:xml:prepare:sh:resources:run:sh:sql:src:target:workdir
The list of files can be replaced by find ...
or something else.
echo
used to replace newlines with spaces.
Final form:
java -cp $(echo `ls -1 *.jar` | sed 's/\W/:/g') com.foo.Bar
source share