380 likes | 527 Views
Outline. -- Massimo Sartori, MSc (PhD Student) Intelligent Autonomous Systems Laboratory (IAS-LAb) Department of Information Engineering, University of Padua Via dei Gradenigo, 35131-IT Tel. +39-049-827-7833 mail: sartori1@dei.unipd.it. Outline.
E N D
Outline -- Massimo Sartori, MSc (PhD Student) Intelligent Autonomous Systems Laboratory (IAS-LAb) Department of Information Engineering, University of Padua Via dei Gradenigo, 35131-IT Tel. +39-049-827-7833 mail: sartori1@dei.unipd.it
Outline • Very Short Introduction to Operating Systems • Introduction to Java and Object-Oriented Programming • Installing Java • Programming Java for Windows • Programming Java for Linux
Operating Systems • It controls the execution of applications • It’s in between the User and the Hardware • It facilitates the use of a machine • software development • programs execution • I/O devices access • fault management • It optimizes the execution of resources • processor (multitasking, scheduler) • memory (paging, virtual memory) • I/O devices (files, I/O buffering)
File System • All Operating Systems allowaccess to files stored on disks • Computers store data on disks using files • It makes disk memories easier to be used • Different Operating Systems Different File Systems Different ways of storing data on the disks.
Root Primo Livello Secondo Livello
File System block • Hard-Disks are organized in several blocks • Each file is distributed in a set of blocks File
Java Programming Language • Object-oriented Programming Language (Sun Microsystem, 1995) • Derived from C/C++ • Java applications runs on a Java Virtual Machine regardless of • computer architecture • Good for computer networks and internet
J-Object-Oriented Programming • Trace its roots to the ‘60s • Software became increasingly complex, quality was often compromised • Object-oriented programming was deployed to maintain quality in software • Traditional Programming: A program is a group of tasks (subroutines) to compute • Object-Oriented Programming: A program is a collection of cooperating objectswhere each object is capable of: • Communicating with another object • Processing Data • Modifying the state of another object • Inheriting characteristics of another object -------------- -------------- ------------- --------------
What is an Object? • Software objects are conceptually similar to real-world objects • They consist of state and related behavior • Methods (Behaviour): • way of communication • operate on the object state • Variables (State) “Hello People!!” length “Hello World” String Bicycle toUpperCase equals toLowerCase contains
What is an Object? Rectangle box = new Rectangle(5, 10, 20, 30); Rectangle box2 = box; box2.translate(15, 25); box box2 box Rectangle Rectangle X = 20 Y= 35 Width = 20 Heigh = 30 box2 X = 5 Y= 10 Width = 20 Heigh = 30 int num = 13; int num2 = num; num2=12; num = 13 num2 = 12
Java Programming Language • Object-oriented Programming Language (Sun Microsystem, 1995) • Derived from C/C++ • Java applications runs on a Java Virtual Machine regardless of • computer architecture • Good for computer networks and internet
Virtual Machine (VM) • Software implementation of a machine (computer) that executes programs like a real machine. • No direct correspondence to real hardware • System virtual machine simulation of a complete operating system (OS) • Process virtual machine designed to run a single program • The software running on a VM is limited to the resources provided by the virtual machine -- it cannot break out of its virtual world.
Java Virtual Machine (JVM) • Implementation of a machine that specifically executes Java code • JVM is a Process Virtual Machine • JVMs available for any computer architecture • JVM is created when the process is started and destroyed when it exits • Provide a platform-independent programming environment • Write once run anywhere
Bytecode and Compiler • Java Virtual Machine operates on Bytecode • Java bytecode is the form of instructions that the Java virtual machine executes Compilation (Translation into Bytecode) Test1.class 21 40 16 100 163 240 Load the program in the memory and execute it Bytecode
Java Virtual Machine (JVM) • JVM is distributed along with a set of standard class libraries • JVM + Libraries = Java Runtime Environment (JRE) NOTE: In computer science, a library is a collection of subroutines to develop software
How to use Java? • We need to download the Java Development Kit (JDK) • JVM + Libraries + Compiler + Loader + Debugger + Other Utilities JRE Utilities
Installing JDK http://www.sun.com
Installing JDK JDK 6 Update 7
Installing JDK Download Windows Offline Installation
Installing JDK Apri con...
Installing JDK File Options
Installing JDK Browse Directory to Download
Installing JDK Ready to Download Start
Installing JDK Run executable file and follow the installation setup
Set the PATH Variable Start Programmi Pannello di Controllo Sistema Avanzate Variabili Ambiente Previous PATH variables;C:\Programmi\Java\jdk1.6.0_07\bin javac FileName.java Compile Program java FileName Run Program For more info http://java.sun.com/javase/6/webnotes/install/jdk/install-windows.html
Run your first program! Start Esegui “cmd”
Installing JDK Documentation Download Zip File and Unzip anywhere Java SE 6 Documentation
Installing JDK Documentation Zip File Unzipped
Installing JCreator http://www.jcreator.com Download (Integrated Development Environment)
Java for Linux Menu Sistema Terminale Menu Accessori Editor KWrite