I presume by the Desktop class you are referring to java.awt.Desktop ?
It has a method: void print(File file)
The method takes a file whereas the code you have provided shows you passing "test.html" - which is a
string representing the name of the file.
I would expect the code to be more like:
Where is the file "test.html" residing on your disk? You may need to modify the "pathToFile" to find it correctly.
Is there more to the error message you have provided? Maybe an exception stack trace? Posting that would help figure out what is going wrong in more detail.