Home > Articles > Programming > Java

  • Print
  • + Share This
From the author of

Compile the Source Code

Assuming that you have a file named MediaPlayer.java (or an equivalent name), use the following command line to compile its source code at a command prompt (such as the Windows MS-DOS command prompt):

javac MediaPlayer.java

Assuming successful compilation, the following class files will be created:

  • MediaPlayer.class (the starting class)

  • MediaPlayer$1.class (the window listener anonymous inner class)

If you encounter compiler error messages, keep the following points in mind:

  • You might have entered incorrect source code.

  • You might have declared the MediaPlayer class public and not saved the source code in a file named MediaPlayer.java.

  • You might have forgotten to include a .java file extension with the filename when specifying the javac command line.

  • + Share This
  • 🔖 Save To Your Account