Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error: illegal character: '\ufeff' in java

Got this error when compiled java code in ubuntu.

![Got this error][1]

error: illegal character: '\ufeff'
import java.net.*;
^
error: class, interface, or enum expected
import java.net.*;
        ^
like image 628
Saurabh Vemuri Avatar asked Aug 15 '17 17:08

Saurabh Vemuri


1 Answers

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
like image 141
Sunny Patel Avatar answered Sep 19 '22 04:09

Sunny Patel