Writing and executing your first java application

 

Write your first java application in Notepad and save it in the file that has the same name as you named your java class.

 

public class Project1

{

………

 

}

In this case class is called Project1. It should be saved in file named Project1.java

 

Invoke Command prompt    (Start, Programs, Command Prompt).

Change the directory to the place where you saved the file.

Compile your application.

 

>javac Project1.java

 

Check to verify that Project1.class was created.      (>dir *.class)

 

Execute your code using java interpreter.

 

>java Project1

 

To document that you executed the code either print the content (text only) of the Dos Command Window or  print the graphical picture of the entire Dos Command Window.

 

The following are the instructions to do each of the two printouts.

 

·        To print the content of the Dos Command Window

·        Right click on the title bar of the window

·        Select Edit, Mark.

·        When you get white square drag it diagonally to mark desired area of text.

·        Right click on the title bar of the window again.

·        Select Edit, Copy. 

·        The above steps should copy the selected area of text into paste buffer.

·        Invoke either notepad application or Word and use Edit, Paste  to paste it there.

·        Print it for me using print from the menu.

 

 

 

·        To print the entire window (This applies to any window not only the Dos window. You may use it to print the window produced by appletviewer as well)

·        Click on the title bar of the Dos Command Window to make sure it is active

·        Press Alt+PrintScreen keys together.

·        This action should copy bitmap picture of the entire window into buffer.

·        Invoke Word  and use Edit, Paste  to paste it there.

·        Print it for me.