1 / 15

Preliminaries

Preliminaries. CS 310: Object-oriented Programming. Java API. Course Focus. Object-oriented Software Development Problem Solving Techniques Object-oriented Programming Concepts Classes and Objects Encapsulation Inheritance Polymorphism GUI and Applets Java Programming Language.

harper
Download Presentation

Preliminaries

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. Preliminaries CS 310: Object-oriented Programming Java API

  2. Course Focus • Object-oriented Software Development • Problem Solving Techniques • Object-oriented Programming Concepts • Classes and Objects • Encapsulation • Inheritance • Polymorphism • GUI and Applets • Java Programming Language

  3. Tools You Will Need • Tools required for this class. • Computer with an Internet connection • Java SDK (J2SE v. 1.5) • Email account • USB drive (thumb drive)

  4. Java SDK (Software Dev. Kit) • Available free from Sun Mycrosystems • http://java.sun.com/j2se/1.5.2/download.html • Download J2SE v. 1.5 SDK (v. 1.6 is also OK) • How to install Java SDK • http://www.rkmaruyama.net/class/310/howto/310howto.html

  5. jGRASP IDE • JGRASP—an integrated development environment, which allows you to edit source code, compile, and run the program. • Available free from jGRASP(click “download” in left column) • Need to have Java SDK installed first

  6. Testing SDK • Create Folder • Each java project should be in separate folder • C:\310\practice\test\ • Use text editor or Java IDE to write source code • Java source code file has extension .java • File name is case-sensitive.

  7. JCreator IDE • JCreator—an integrated development environment, which allows you to edit source code, compile, and run the program. • Available free from XINOXhttp://www.jcreator.com/ • Need to have Java SDK installed first • How to install JCreatorhttp://www.rkmaruyama.net/class/310/310howto

  8. Java Virtual Machine Text Editor Compiler JVM Source Code Bytecode Output

  9. Sample Source Code • Write the following code exactly, and save it as HelloTest.java. class HelloTest{ public static void main(String[] args){ System.out.print("Hello, world.”); } )

  10. Compile Source Code • Assume: • JDK is installed in D:\jdk15 • Set path--To make JDK compiler visible in any folder • Set path D:\jdk15\bin • Check path • C:\> path -- DOS command • D:\jdk15\bin -- path

  11. Create Byte Code Compile the source code to create a byte code, as follows. D:\310\hello> javac HelloTest.java If there are syntax errors, correct the source code and recompile. The result of a successful compilation is a byte code file named HelloTest.class.

  12. Run Program • Run the program as follows: • D:310\hello> java HelloTest

  13. Useful DOS Commands • C:\> cd 310 -- Go down one level to 310 folder • C:\310> cd ..-- Go up one level, to C:\> • C:\310> D:-- Change to drive DC:\310\> dir -- List all files in the folder • C:\310\> del fileName.ext -- Delete fileName.ext • C:\310\> md aFolder -- Create aFolder • C:\310\> rd oldFolder -- Delete oldFolder

  14. JAR Files • JAR Files—Java Archive files • To package several files into one file • To compress them • For easier transmission over the Internet

  15. JAR Files (cont.) • Syntaxjar {options} jar-file-name file1 file2 file3 • Assume: Mypro.java, Mypro.class, Show.html exist in current folder.jar cf rkm.jar Mypro.jar Mypro.class show.htm • For more details refer toHowTo Create Jar.http://www.rkmaruyama.net/class/310/310howto

More Related