Knight moves in a 8*8 chess board
First of all, you're using a wrong algorithm. A depth-first finds some path, but not necessarily the shortest one. What you actually need is a breadth-first search. You can just use a queue instead of a stack to fix it. 

Storing everything as a string is bad idea. You code'll be much better if you use appropriate data types. The position on the board or a shift vector for one move is not string. I'd suggest to create a separate Position class that holds a pair of integers to represent a position on the board and has a shiftBy and an isValid method (to get the next position after one move and to check if a position is valid). 

I'd also recommend to separate the code that reads the data and prints the result from the part that actually runs the computations. 

Fixing the indentation and spacing of code according to the Java coding convention would make it more readable. 

The names of the variables are also not very descriptive. For instance, what does ele mean? What is str (which is, in fact, not really a string)? I have no clue. It should be something like currentPosition and shiftVector because that's what it actually is.