Creating a Java Program - PowerPoint PPT Presentation

1 / 7
About This Presentation
Title:

Creating a Java Program

Description:

Create a .java file with an editor. Notepad, Jbuilder, BlueJ, JCreator, Eclipse ... Windows XP. Windows JVM. AlgoPract1.class. library and user .class. Mac ... – PowerPoint PPT presentation

Number of Views:198
Avg rating:3.0/5.0
Slides: 8
Provided by: chan82
Category:

less

Transcript and Presenter's Notes

Title: Creating a Java Program


1
Creating a Java Program
  • by mr. Hanley
  • 2/2/2007

2
How do we create a java program?
  • Steps
  • Create a .java file with an editor
  • Notepad, Jbuilder, BlueJ, JCreator, Eclipse
  • AlgoPractice1.java saved
  • Compile the program using javac
  • javac AlgoPractice1.java
  • AlgoPractice1.class is created if successful
  • Execute the program by launching VM
  • javaw AlgoPractice1.class

3
How does the VM work?
  • The Java Virtual Machine is responsible for
    loading in your program and interpreting it on
    your current platform(Operating System)
  • Thus, java is compiled at build time and
    interpreted at run time

4
How does java live up to Suns write once, run
everywhere motto?
library and user .class
AlgoPract1.class
Sun JVM
Windows JVM
Mac JVM
Solaris (Unix)
Windows XP
Mac OS
Sun Server Hardware
PC Hardware
Mac Hardware
5
JVM interprets commands
  • The JVM must take the .class files that you
    create via the compiler and translate them into
    commands for the particular operating system you
    are running on

6
Jbuilders approach
  • New class allows you to edit a .java file (src
    directory)
  • Note Comments dont compile
  • Make attempts to compile your .java file and
    creates a .class file (classes directory)
  • Run Project attempts to load .class file
    specified in project settings
  • must have a main method in order to execute

7
Run project
  • Choosing Run Project(F9) or the Play Button will
    attempt to do both of the 2nd and 3rd prior steps
  • It will compile any files that are changed
  • It will attempt to start up the JVM
Write a Comment
User Comments (0)
About PowerShow.com