Let's call it a Java program or Java code to eliminate any confusion with the language JavaScript.
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:
javac MyClass.java
java MyClass
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.