1. Technology

Building Your First Java Applet

By

7 of 10

Compile the Applet
Compile the Applet

Microsoft product screen shot(s) reprinted with permission from Microsoft Corporation.

We’re now ready to compile the applet. To do so, enter the command:

javac FirstApplet.java

After you hit Enter, the compiler will look at the code contained within the FirstApplet.java file, and attempt to compile it. If it can’t, it will display a series of errors to help you fix the code.

The applet has been compiled successfully if you are returned to the command prompt without any messages. If that’s not the case, go back and check the code you’ve written. Make sure it matches the example code and re-save the file. Keep doing this until you can run javac without getting any errors.

Tip: Once the applet has been successfully compiled, you will see a new file in the same directory. It will be called “FirstApplet.class”. This is the compiled version of your applet.

  1. About.com
  2. Technology
  3. Java
  4. Web Applications
  5. Building Your First Java Applet: Compiling

©2014 About.com. All rights reserved.