Class diagram and component diagram are different. Unless the application is too trivial, we'll not have a class acting as a component.Even in this case, better practice is to put this class along with support classed in a package and add it to the component diagram.
A component can be an application,
applet,exe,DLL,package,database ..etc.
In
java context, a component can be an application,applet,package,database,main program, sub program ..etc.
It is not a good practice to put classes in component diagram.