Java regex - Split by one point "." (dot)

You should avoid the dot if you want to apply a split to a literal point:

String withoutextension=filename.split("\\.") [0]; 

If you don't add the double anti slash, the '.' alone means no characters and you get an exception  ArrayIndexOutOfBoundsException  because the input string is a period ".". This exception is raised when java does not find the regex it is looking for and the output array is empty.