The least invasive "Manual" way to do this (also the most hacky) is probably to create a static variable in your class that is having the recursion issue. When you enter the recursive method use it to count the recursion depth (by adding or subtracting) and when you exit, reverse what you did upon entry.
This isn't great but it is a lot better than trying to set a stack depth (Nearly any system call in java will blow through 5 levels of stack without even blinking).
If you don't use a static you may end up having to pass your stack depth variable through quite a few classes, it's very invasive to the rest of your code.
As an alternative I suggest you let it fail "normally" and throw the exception then meditate upon the stack trace for a while--they are really informative and will probably lead you to the source of your problem more quickly than anything else.
static int maxDepth = 5;
public void recursiveMethod() {
if(maxDepth-- == 0)
throw new IllegalStateException("Stack Overflow");
recursiveMethod();
maxDepth++;
}