How to Calculate JavaScript

How to Calculate JavaScript thumbnail
Calculate Java using a compiler on your computer

JavaScript would mean nothing if there was not a program to calculate and interpret it. This program is called a compiler. You will need to have the Java compiler installed on your computer before you can run and test any Java code. Doing this is easy; in fact, if you are running a Mac, Java should already be installed. If you are on a PC, Java can be installed within minutes, and you be able to calculate all the Java script you'd like.

Instructions

  1. Obtaining Java

    • 1

      Download Java (see Resources section). Click the red "Download" button to start downloading Java.

    • 2

      Install Java. When the download is finished, double-click the file to install Java.

    • 3

      Go to "Start," "Programs," "Accessories" and "Command Prompt." In the Command Prompt, type "java" (without the quotes) and hit "Enter." You will see a list of usages for the Java command, confirming that Java is installed.

    Calculating JavaScript

    • 4

      Open up your favorite text editor. Any text editor will do.

    • 5

      Type the following java code:
      class HelloWorldProg
      {
      public static void main(String args[])
      {
      System.out.println("Hi there, World!");
      }
      }

    • 6

      Go to "File," "Save as" and type "HelloWorldProg.java" (without the quotes) in the file name box. Click "Save."

    • 7

      Open a terminal by going to "Start," "Programs," "Accessories" and "Command Prompt" (on a PC) or by searching "Terminal" in Spotlight (on a Mac).

    • 8

      Navigate to the directory where you saved your Java file by typing "cd Your_Directory_Name" (without the quotes) and hitting "Enter."

    • 9

      Type "javac HelloWorldProg.java" (without the quotes) and hit "Enter." This runs the Java compiler, which calculates your Java code and spits out a runnable Java program. Type "java HelloWorldProg" (without the quotes) and hit "Enter" to run your program. You will see the words "Hi there, World!" printed out to the screen of the terminal.

Related Searches:

References

Resources

  • Photo Credit computer image by Hao Wang from Fotolia.com

Comments

You May Also Like

Related Ads

Featured