I have been looking around but I have not found any approach that will allow me to run a single test from a JUnit class using only command-line.

I can run the whole set of tests from the class using the following:

java -cp .... org.junit.runner.JUnitCore org.package.classname

What I really want to do is something like this:

java -cp .... org.junit.runner.JUnitCore org.package.classname.method

or

java -cp .... org.junit.runner.JUnitCore org.package.classname#method

I noticed that there might be ways to do this using JUnit annotations, but I would prefer to not modify the source of my test classes by hand (attempting to automate this). I did also see that Maven might have a way to do this, but if possible I would like to avoid depending on Maven.

Cool, another "Unix is my IDE" type enthusiast. I like using an IDE for an editor (particularly with the vim plugin for NetBeans), but I agree that small sharp tools that last "forever", and can be assembled in arbitrary configurations, are often better than constantly relearning esoteric features of a continuing series of IDE brands and versions. Good for you!
–
RoboprogApr 25 '12 at 17:03

After a quick look in the JUnit source I came to the same conclusion as you that JUnit does not support this natively. This has never been a problem for me since IDEs all have custom JUnit integrations that allow you to run the test method under the cursor, among other actions. I have never run JUnit tests from the command line directly; I have always let either the IDE or build tool (Ant, Maven) take care of it. Especially since the default CLI entry point (JUnitCore) doesn't produce any result output other than a non-zero exit code on test failure(s).

Thank you, this is exactly what I needed.
–
Kevin JalbertFeb 15 '12 at 15:56

Actually, I seem to remember getting a full stack trace in the log when an assertion in a test failed, as well as the (optional, when defined) message from each assertion describing the unrealized expectation. Thanks for the work-around.
–
RoboprogApr 25 '12 at 17:01