I don't understand what you are looking to do here. If you open a file with an IO handling method, you retrieve it as text. It'll only do something if you parse it and handle it in some fashion.
If you want to run it over http embeded in an html file, use an applet. If you want to handle it as server code over http, use a servlet or JSP. If you want to handle a desktop application capable of communicating over http, then look at writing a JFrame and establish http connections.