Is it possible to remove folder prefix from a `ls` command

Instead of parsing ls you should use find instead. Then you can also execute basename on each file to strip the leading directories:

find lib/ -name '*.jar' -exec basename {} \;

With GNU find there is no need to run basename for every single file, this will be much faster (especially if there is a lot of files):

find lib -name '*.jar' -printf '%P\n'

How about (cd lib && echo *.jar), assuming that you don't have whitespace or special characters in the file names. Parent script never changes directory.