Search code examples
javabyte-order-mark

How do you easily delete a Byte Order Mark (BOM) from a .java file or other types of file?


I kept having compile errors on my Continuous Integration & Deployment system.

After some research I found that it was a BOM (Byte Order Mark) at the beginning of a .java file that was causing the error.

What is the easiest way to remove the BOM from the file?


Solution

  • I searched for various solutions (such as VI, VIM, and scripts), but in the end the easiest solution was to utilize p4merge, which allows you to view the BOM and simply delete it.

    You can get p4merge here for free.

    I'm not affiliated with p4merge in anyway, but I do use it and find it useful as a diff/merge tool.