First, you'll need to compile your code. Then you can run it. If your code is in MyClass.java file, you'd do something like this:
You will need to have a Java Development Kit installed for this.
You can read a bit more here: http://www.skylit.com/javamethods/faqs/javaindos.html.