Creating Your First Application

1.2 Creating Your First Application

This lesson provides detailed instructions for compiling and running a simple "Hello World!" application.
Your first application, HelloWorldApp, will simply display the greeting "Hello world!". To create this program, you will:
  • Create a source file
  • Compile the source file into a .class file
  • Run the program
The following instructions are for users of Windows 7/8.

Create a source file

Start Notepad. In a new document, type in the following code:
Create a folder in C: drive with name java (or the name of the folder you wish to create). We’ll save our file in this folder. Save this file HelloWorldApp.java

Compile the source file

i. Open Start > Accessories > Command Prompt
ii. Type cd \java
iii. Type javac HelloWorldApp.java

Run

Now, type java HellWorldApp and press enter
Congratulations! Your program works! It displays Hello World! on screen. Now we will discuss basics of java program in next lesson.

No comments:

Post a Comment

Pages