Mathematical Preliminaries Strings and Languages Preliminaries 1.
Preliminaries
description
Transcript of Preliminaries
![Page 1: Preliminaries](https://reader036.fdocuments.us/reader036/viewer/2022083006/56813a7e550346895da27c2f/html5/thumbnails/1.jpg)
PreliminariesPreliminaries
CS 310: Object-oriented CS 310: Object-oriented ProgrammingProgramming
Java API
![Page 2: Preliminaries](https://reader036.fdocuments.us/reader036/viewer/2022083006/56813a7e550346895da27c2f/html5/thumbnails/2.jpg)
Course FocusCourse Focus
Object-oriented Software DevelopmentObject-oriented Software Development Problem Solving TechniquesProblem Solving Techniques Object-oriented Programming ConceptsObject-oriented Programming Concepts
Classes and ObjectsClasses and Objects EncapsulationEncapsulation InheritanceInheritance PolymorphismPolymorphism
GUI and Applets GUI and Applets Java Programming LanguageJava Programming Language
![Page 3: Preliminaries](https://reader036.fdocuments.us/reader036/viewer/2022083006/56813a7e550346895da27c2f/html5/thumbnails/3.jpg)
Tools You Will NeedTools 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)
![Page 4: Preliminaries](https://reader036.fdocuments.us/reader036/viewer/2022083006/56813a7e550346895da27c2f/html5/thumbnails/4.jpg)
Java SDK (Software Dev. Java SDK (Software Dev. Kit)Kit)
Available free from Sun MycrosystemsAvailable free from Sun Mycrosystems http://java.sun.com/j2se/1.5.2/http://java.sun.com/j2se/1.5.2/
download.htmldownload.html Download J2SE v. 1.5 SDK (v. 1.6 is also Download J2SE v. 1.5 SDK (v. 1.6 is also
OK)OK) How to install Java SDKHow to install Java SDK
http://www.rkmaruyama.net/class/310/http://www.rkmaruyama.net/class/310/howto/310howto.htmlhowto/310howto.html
![Page 5: Preliminaries](https://reader036.fdocuments.us/reader036/viewer/2022083006/56813a7e550346895da27c2f/html5/thumbnails/5.jpg)
jGRASP IDEjGRASP IDE
JGRASP—an integrated development JGRASP—an integrated development environment, which allows you to environment, which allows you to edit source code, compile, and run edit source code, compile, and run the program.the program.
Available free from Available free from jGRASPjGRASP(click “download” in left column)(click “download” in left column)
Need to have Java SDK installed firstNeed to have Java SDK installed first
![Page 6: Preliminaries](https://reader036.fdocuments.us/reader036/viewer/2022083006/56813a7e550346895da27c2f/html5/thumbnails/6.jpg)
Testing SDKTesting SDK
Create FolderCreate Folder Each java project should be in separate Each java project should be in separate
folderfolder C:\310\practice\test\C:\310\practice\test\
Use text editor or Java IDE to write Use text editor or Java IDE to write source codesource code Java source code file has extension Java source code file has extension .java.java File name is File name is case-sensitivecase-sensitive..
![Page 7: Preliminaries](https://reader036.fdocuments.us/reader036/viewer/2022083006/56813a7e550346895da27c2f/html5/thumbnails/7.jpg)
JCreator IDEJCreator IDE
JCreator—an integrated development JCreator—an integrated development environment, which allows you to edit environment, which allows you to edit source code, compile, and run the source code, compile, and run the program.program.
Available free from XINOXAvailable free from XINOXhttp://www.jcreator.com/http://www.jcreator.com/
Need to have Java SDK installed firstNeed to have Java SDK installed first How to install JCreatorHow to install JCreator
http://www.rkmaruyama.net/class/310http://www.rkmaruyama.net/class/310/310howto/310howto
![Page 8: Preliminaries](https://reader036.fdocuments.us/reader036/viewer/2022083006/56813a7e550346895da27c2f/html5/thumbnails/8.jpg)
Java Virtual MachineJava Virtual Machine
Source Code Bytecode Output
Text Editor Compiler JVM
![Page 9: Preliminaries](https://reader036.fdocuments.us/reader036/viewer/2022083006/56813a7e550346895da27c2f/html5/thumbnails/9.jpg)
Sample Source CodeSample Source Code
Write the following code exactly, and Write the following code exactly, and save it as save it as HelloTest.javaHelloTest.java..
class HelloTest{ public static void main(String[] args){ System.out.print("Hello, world.”); })
![Page 10: Preliminaries](https://reader036.fdocuments.us/reader036/viewer/2022083006/56813a7e550346895da27c2f/html5/thumbnails/10.jpg)
Compile Source CodeCompile Source Code
Assume:Assume: JDK is installed in D:\jdk15JDK is installed in D:\jdk15
Set path--To make JDK compiler Set path--To make JDK compiler visible in any foldervisible in any folder Set path D:\jdk15\binSet path D:\jdk15\bin
Check pathCheck path C:\> pathC:\> path -- DOS command -- DOS command D:\jdk15\bin -- pathD:\jdk15\bin -- path
![Page 11: Preliminaries](https://reader036.fdocuments.us/reader036/viewer/2022083006/56813a7e550346895da27c2f/html5/thumbnails/11.jpg)
Create Byte CodeCreate Byte Code
Compile the source code to create a Compile the source code to create a byte codebyte code, as follows., as follows. D:\310\hello> javac HelloTest.javaD:\310\hello> javac HelloTest.java
If there are syntax errors, correct the If there are syntax errors, correct the source code and recompile.source code and recompile.
The result of a successful compilation The result of a successful compilation is a byte code file named is a byte code file named HelloTest.classHelloTest.class..
![Page 12: Preliminaries](https://reader036.fdocuments.us/reader036/viewer/2022083006/56813a7e550346895da27c2f/html5/thumbnails/12.jpg)
Run ProgramRun Program
Run the program as follows:Run the program as follows: D:310\hello> D:310\hello> java HelloTestjava HelloTest
![Page 13: Preliminaries](https://reader036.fdocuments.us/reader036/viewer/2022083006/56813a7e550346895da27c2f/html5/thumbnails/13.jpg)
Useful DOS CommandsUseful DOS Commands C:\> cd 310C:\> cd 310 -- Go down one level to -- Go down one level to
310 folder 310 folder C:\310> cd ..C:\310> cd .. -- Go up one level, to C:\>-- Go up one level, to C:\> C:\310> D:C:\310> D: -- Change to drive D-- Change to drive D
C:\310\> dirC:\310\> dir -- List all files in the folder -- List all files in the folder C:\310\> del fileName.extC:\310\> del fileName.ext -- Delete -- Delete
fileName.ext fileName.ext C:\310\> md aFolderC:\310\> md aFolder -- Create -- Create
aFolder aFolder C:\310\> rd oldFolderC:\310\> rd oldFolder -- Delete -- Delete
oldFolderoldFolder
![Page 14: Preliminaries](https://reader036.fdocuments.us/reader036/viewer/2022083006/56813a7e550346895da27c2f/html5/thumbnails/14.jpg)
JAR FilesJAR Files
JAR Files—Java Archive filesJAR Files—Java Archive files To package several files into one fileTo package several files into one file To compress themTo compress them For easier transmission over the InternetFor easier transmission over the Internet
![Page 15: Preliminaries](https://reader036.fdocuments.us/reader036/viewer/2022083006/56813a7e550346895da27c2f/html5/thumbnails/15.jpg)
JAR Files (cont.)JAR Files (cont.)
SyntaxSyntaxjar {options} jar-file-name file1 file2 file3jar {options} jar-file-name file1 file2 file3
Assume: Assume: Mypro.java, Mypro.class, Mypro.java, Mypro.class, Show.htmlShow.html exist in current folder. exist in current folder.
jar cf rkm.jar Mypro.jar Mypro.class show.htmjar cf rkm.jar Mypro.jar Mypro.class show.htm
For more details refer toFor more details refer to HowToHowTo Create Jar Create Jar..http://www.rkmaruyama.net/class/310/310howtohttp://www.rkmaruyama.net/class/310/310howto