If you want to run it online, you'll need to wrap it in an applet.
I'd start by wrapping it in a gui, and then wrap that into the applet. Command line apps don't really work well in web environment, although technically you can write the interception for the input on the applet, but you may as well make it look pretty first.
Split the classes up as well; the cli interface can be abandoned when you write the gui, but the logic is good for both.
header('HTTP/1.1 420 Enhance Your Calm');