1 / 7

Creating a Java Program

Creating a Java Program. by mr. Hanley 2/2/2007. 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

Download Presentation

Creating a Java Program

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  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 Sun’s “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. Jbuilder’s approach • New class = allows you to edit a .java file (src directory) • Note: Comments don’t 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

More Related