AHS,
I figured what you are trying to say and would want to package all the
stuff inside the jar.
I tried to do that using Eclipse export (File>export) but the 'Launch
Configuration' drop-down list of 'Runnable JAR File Specification'
dialog box is empty.
Did I miss something?
Thanks.
You've got several issues here. I use Eclipse a lot but not so much with
exporting runnable JARs. I do know this, if you try to export your
project as a Runnable JAR then you need a "Java Application" launch
configuration.
There are JUnit launch configurations also available, and these can be
quite useful when running tests otherwise (so you don't have to specify
launch parameters over and over again, basically). But in order to run
JUnit tests you need a main class to do it with, for the executable JAR.
One easy way to do it is, set up a JUnit test suite. Add a main() method
to the test suite class that uses JUnitCore.main() or
JUnitCore.runClasses(). Once you've got this, set that test suite class
up as the Main class in a "Java Application" launch configuration. And
once you've got that, it's available in your Runnable JAR launch
configuration dropdown.
As an aside, I like the Runnable JAR export option of copying the
required libraries (in this case that would include JUnit and Hamcrest,
plus any JARS that your real code uses) into a sub-folder next to the
generated JAR. For distribution you can then simply ZIP that library
folder and the generated executable JAR, plus any run scripts and READMEs.
AHS