1. Home
  2. Computing & Technology
  3. Java

Create a Simple Window Using JFrame

By , About.com Guide

7 of 7

Save, Compile and Run

Run the Application

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

Save the file as "TopLevelWindow.java".

Compile the application in a terminal window using the Javac compiler. If you’re unsure how to do so, look at the compilation steps from the first Java application tutorial.

javac TopLevelWindow.java

Once the application compiles successfully, run the program:

java TopLevelWindow

After pressing Enter, the window will appear, and you will see your first windowed application!

Well done, this tutorial is the first building block to making powerful user interfaces. Now that you know how to make the container, you can play with adding other graphical components.

Explore Java
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Java
  4. Tutorials
  5. Save, Compile and Run

©2009 About.com, a part of The New York Times Company.

All rights reserved.