you cannot do this. Class files are used in Java
applications - Java can interact with a web browser either on the
client side (applet, downloaded from the server and run in the
browser) or server side (servlet, JSP, etc). Servlets are in fact
class files that are compiled on the server side and sent back to the
browser as part of the end-product HTML (as JSPs also compile as
servlets). I think the confusion is coming from the distinction
between Java applications and Java web entities (applet/servlet).