User Tools

Site Tools


How To Execute A Java File

Executing a Java file requires the use of Windows Command Prompt (Windows), Terminal/Shell (Mac & Linux), or an IDE.

The screenshots below are from Windows Command Prompt, but the java commands will look the same whether using Windows, Mac, Linux, or remote terminals such as PuTTY.

  1. Change the working directory to the location in which the .java file you wish to run is contained. For the screenshot below, for example, the working directy was e:\csci wiki\java

  2. Make sure the .java file has been compiled before moving to the next step.

  3. Type java filenameX, where filenameX is the name of the file to be ran without the extension, and press the Enter or Return key.

  4. The JAVA file should have executed.

how_to_execute_a_java_file.txt · Last modified: 2013/07/25 11:11 by jhuber