Yes, you've created a file but just because the file name ends with ".xls" does not mean it's an Excel file.
If you really want to read/write an Excel file the best way to do it is with the Apache POI library. It is not a particularly simple library though and would probably present difficulties to a
Java beginner.
Another way to approach the problem is by writing out a CSV (comma separated variable) file which is a basic text file separating columns of data with commas. Excel can read and write CSV files. You won't need a library for this.