error: illegal character: '\ufeff' in java

As Jim Garrison pointed out, you probably have a Byte Order Marker (BOM) at the start of the file. Use an editor that can view all non-printable characters and remove it.

Alternatively, you can use sed to remove it:

sed '1s/^.//' infile >> outfile

In case your are working on Windows O.S. and use Eclipse (which don't have the functionality to remove the BOM from the file), just open the file in Notepad++ and in the encoding menu, select "UTF-8", then save the file.


If you are using IntelliJ, right click on the class file and select 'Remove BOM'. That should remove the BOM at the start.