Presentation is loading. Please wait.

Presentation is loading. Please wait.

Preliminaries CS 310: Object-oriented Programming Java API.

Similar presentations


Presentation on theme: "Preliminaries CS 310: Object-oriented Programming Java API."— Presentation transcript:

1 Preliminaries CS 310: Object-oriented Programming Java API

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

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

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

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

6 Testing SDK Create Folder Create Folder Each java project should be in separate folder Each java project should be in separate folder C:\310\practice\test\ C:\310\practice\test\ Use text editor or Java IDE to write source code Use text editor or Java IDE to write source code Java source code file has extension.java Java source code file has extension.java File name is case-sensitive. 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. JCreator—an integrated development environment, which allows you to edit source code, compile, and run the program. Available free from XINOX http://www.jcreator.com/ Available free from XINOX http://www.jcreator.com/ http://www.jcreator.com/ Need to have Java SDK installed first Need to have Java SDK installed first How to install JCreator http://www.rkmaruyama.net/class/310/310h owto How to install JCreator http://www.rkmaruyama.net/class/310/310h owto http://www.rkmaruyama.net/class/310/310h owto http://www.rkmaruyama.net/class/310/310h owto

8 Java Virtual Machine Source CodeBytecodeOutput Text EditorCompilerJVM

9 Sample Source Code Write the following code exactly, and save it as HelloTest.java. 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: Assume: JDK is installed in D:\jdk15 JDK is installed in D:\jdk15 Set path--To make JDK compiler visible in any folder Set path--To make JDK compiler visible in any folder Set path D:\jdk15\bin Set path D:\jdk15\bin Check path Check path C:\> path -- DOS command C:\> path -- DOS command D:\jdk15\bin -- path D:\jdk15\bin -- path

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

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

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

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

15 JAR Files (cont.) Syntax jar {options} jar-file-name file1 file2 file3 Syntax jar {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 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 to HowTo Create Jar. http://www.rkmaruyama.net/class/310/310howto For more details refer to HowTo Create Jar. http://www.rkmaruyama.net/class/310/310howtoHowTo Create Jar. http://www.rkmaruyama.net/class/310/310howtoHowTo Create Jar. http://www.rkmaruyama.net/class/310/310howto


Download ppt "Preliminaries CS 310: Object-oriented Programming Java API."

Similar presentations


Ads by Google