Lecture 4 FrameEditorDemo Packages System Object Runtime Object File Systems.

Slides:



Advertisements
Similar presentations
Introduction to Java 2 Programming Lecture 4 Writing Java Applications, Java Development Tools.
Advertisements

Introduction to Eclipse cs112b1 – Lab01 by Rui Shi.
COP 3530 JDK Environment Variables. COP 3530 JDK Environment Variables Environment Variables Environment variables are a set of dynamic values that can.
Packages Sudhir Talasila Preeti Navale. Introduction Packages are nothing more than the way we organize files into different directories according to.
Introduction to the gedit editor. gedit: the Gnome editor Gnome: Gnome is a freely available (i.e., no cost) desktop environment for the UNIX system The.
ANT: Another Nice Tool Ali Beyad October 1, 2003.
Client Side Programming Using Java Applet Outcomes: You will be expected to know: – Java Applets and HTML file; –bytecode and platform independent programs;
MIRC Matthew Forest. Introduction mIRC itself is a program designed for text based messaging via the IRC (internet relay chat) protocol. (Link:
Linux+ Guide to Linux Certification, Second Edition
Chapter 5 Accessing Files and Directories. How Directories Get Created OS installation: usr, dev, etc, export, kernel and others places to store installation.
Creating an application in Netbeans. Goal of this tutorial Project 1 requires you to develop and test a graphical user interface (GUI) Netbeans allows.
1 An Introduction to Visual Basic Objectives Explain the history of programming languages Define the terminology used in object-oriented programming.
Operating Systems Concepts 1. A Computer Model An operating system has to deal with the fact that a computer is made up of a CPU, random access memory.
Command Console Tutorial BCIS 3680 Enterprise Programming.
1 SEEM3460 Tutorial Unix Introduction. 2 Introduction What is Unix? An operation system (OS), similar to Windows, MacOS X Why learn Unix? Greatest Software.
JSP and Servlets Lecture notes by Theodoros Anagnostopoulos.
1 CSE 331 Java Packages; JAR Archives slides created by Marty Stepp based on materials by M. Ernst, S. Reges, D. Notkin, R. Mercer, Wikipedia
Chapter 3.1:Operating Systems Concepts 1. A Computer Model An operating system has to deal with the fact that a computer is made up of a CPU, random access.
Installing and Configuring Tomcat A quick guide to getting things set up on Windows.
Computer Systems Week 10: File Organisation Alma Whitfield.
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
DEPARTMENT OF COMPUTER SCIENCE & TECHNOLOGY FACULTY OF SCIENCE & TECHNOLOGY UNIVERSITY OF UWA WELLASSA ‏ Packages.
Lesson 7-Creating and Changing Directories. Overview Using directories to create order. Managing files in directories. Using pathnames to manage files.
Microsoft Visual Basic 2005: Reloaded Second Edition
8 Shell Programming Mauro Jaskelioff. Introduction Environment variables –How to use and assign them –Your PATH variable Introduction to shell programming.
An intro to programming. The purpose of writing a program is to solve a problem or take advantage of an opportunity Consists of multiple steps:  Understanding.
OS provide a user-friendly environment and manage resources of the computer system. Operating systems manage: –Processes –Memory –Storage –I/O subsystem.
Linux+ Guide to Linux Certification, Second Edition
Section 3.1: Operating Systems Concepts 1. A Computer Model An operating system has to deal with the fact that a computer is made up of a CPU, random.
Database-Driven Web Sites, Second Edition1 Chapter 5 WEB SERVERS.
UCSC All rights reserved. No part of this material may be reproduced and sold. 1 IT1202-Fundamentals Of Programming (Using JAVA) Interacting with.
© 2005 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. Data Structures for Java William H. Ford William R. Topp Appendix E The EZJava.
The Basics of Javadoc Presented By: Wes Toland. Outline  Overview  Background  Environment  Features Javadoc Comment Format Javadoc Program HTML API.
1 Module Objective & Outline Module Objective: After completing this Module, you will be able to, appreciate java as a programming language, write java.
Introduction to Eclipse CSC 216 Lecture 3 Ed Gehringer Using (with permission) slides developed by— Dwight Deugo Nesa Matic
1 Week 2 The Crunchy Shell to the Soft and Chewy Kernel… Sarah Diesburg 8/3/2010 COP4610 / CGS5765.
Deployment via jars and Webstart. How do we distribute our application? Lab says you need to submit CD Lab says you need to submit CD Limitations of CD.
9/2/ CS171 -Math & Computer Science Department at Emory University.
Linux file system "On a UNIX system, everything is a file; if something is not a file, it is a process." Sorts of files (on a Linux system) Directories:
EE2E1. JAVA Programming Lecture 3 Java Programs and Packages.
Topics Introduction Scene Graphs
Tool Install How to download & install Java 6 & Eclipse updated version based on Dr. G. L. Ray’s slides.
Linux+ Guide to Linux Certification, Third Edition
Linux+ Guide to Linux Certification, Third Edition
22-July-2002cse142-13B-Development © 2002 University of Washington1 Development Tools CSE 142, Summer 2002 Computer Programming 1
Core Java Introduction Byju Veedu Ness Technologies httpdownload.oracle.com/javase/tutorial/getStarted/intro/definition.html.
Advanced Programming in the UNIX Environment Hop Lee.
2 Manual & Filestore Mauro Jaskelioff. Introduction Using the manual The UNIX filestore File permissions.
Building Packages BCIS 3680 Enterprise Programming.
UNIX File System By Vishal Desai. Introduction Basic purpose of file system: Represent and organize the system resources. But UNIX File System also maps.
1 G52IWS: Example Web-services Chris Greenhalgh. 2 Contents Software requirements AXIS web service run-time components Getting started with Jetty & AXIS.
THE C PROGRAMMING ENVIRONMENT. Four parts of C environment  Main menu  Editor status line and edit window  Compiler message window  “Hot Keys” quick.
Lecture 02 File and File system. Topics Describe the layout of a Linux file system Display and set paths Describe the most important files, including.
The Development Process Compilation. Compilation - Dr. Craig A. Struble 2 Programming Process Problem Solving Phase We will spend significant time on.
Today Javadoc. Packages and static import. Viewing API source code. Upcoming Topics: –protected access modifier –Using the debugger in Eclipse –JUnit testing.
CS 201 Lecture 1 (b) Using an IDE Tarik Booker CS 201: Introduction to Programming California State University, Los Angeles.
Company LOGO Security in Linux PhiHDN - VuongNQ. Contents Introduction 1 Fundamental Concepts 2 Security System Calls in Linux 3 Implementation of Security.
CS-140 Dick Steflik Lecture 3. Java C++ Interpreted optimized for the internet Runs on virtual ized machine Derived from C++ Good object model Widely.
Protecting Memory What is there to protect in memory?
Chapter 11 Command-Line Master Class
Linux file system "On a UNIX system, everything is a file;
Key Ideas from day 1 slides
The Linux Operating System
Programming without BlueJ Week 12
Java Basics Packages.
Introduction to Linux Week 0 - Thursday.
Advanced Programming in Java
Java IDE Dwight Deugo Nesa Matic Portions of the notes for this lecture include excerpts from.
CMPE212 – Reminders Assignment 2 due today, 7pm.
SPL – PS1 Introduction to C++.
Presentation transcript:

Lecture 4 FrameEditorDemo Packages System Object Runtime Object File Systems

AbstractButtons (JVM) Files quitButton Edit tools interacts with runs creates User FrameEditorTester GameFrame FrameEditor User reads/writes

AbstractButtonsEdit tools FrameEditorTester GameFrame FrameEditor quitButton Flow of ActionEvents ? ?

AbstractButtonsEdit tools quitButton initial calls to addActionListener() relayed calls to addActionListener() FrameEditorTester GameFrame FrameEditor Effect of wrapper addActionListener methods

Packages Hierarchy of classes, independent of inheritance. Packages group classes related by function. A package is a namespace protected/package access specifiersprotected/package

Creating Packages First line of each file is: package packagename; To access a class: import packagename.classname; To access all classes from a package: import packagename.*; Each package has its own directory, named packagename.

Using Packages By default, files are in the “unnamed package.” This is only ok for very small projects. Can have hierarchies of packages. Ex: com.company.region.package. This corresponds to the directory $CLASSPATH/com/company/region/package. There are a few naming conventions.naming conventions Separate import statements for each package, even subpackages.

Example Package Layout frameeditor apptranspres

File Layout frameeditor app trans pres FrameEditor.java EditorFrame EditorPanel EditorMenuBar IconSelector HelpFrame EditorToolbar TargetHandler EditorPanelHandler EditorMenuHandler FileSaver EditUndoer (unnamed) ActionFrame.java

Package code frameeditor.FrameEditor: package frameeditor; import ActionFrame; import frameeditor.pres.*; import frameeditor.app.*; import frameeditor.trans.*; frameeditor.pres.EditorFrame: package frameeditor.pres; import ActionFrame; import frameeditor.FrameEditor; frameeditor.trans.EditorMenuHandler: package frameeditor.trans; import ActionFrame; import frameeditor.FrameEditor; import frameeditor.app.*; import frameeditor.pres.EditorMenuBar;

Package Details Matters where you compile from. Java and Javac look in 2 places for packages: $CLASSPATH, and the current directory. Java, Javac can find classes and directories stored in ZIP and JAR archives. May have to disambiguate names, e.g. javax.swing.Timer, java.util.Timer and com.thomasphayes.silly.Timer

File Systems A standardized, high-level mechanism to allow a user or users to access organized data on a medium or media. Usually a rooted tree at heart (Unix), sometimes a rooted forest (Win*), may be a directed graph (both fake this). Files, directories, paths. Permissions, owners, locks.

Paths Steps from one node to another. May be absolute (starts at root), canonical (absolute, plus no redundancies or shortcuts), or relative (starts somewhere else).. = current,.. = parent, / or \ = file- separator, : or ; = path-separator. Root: / in Unix. L:\ in Win*

Warning: File systems Notably, the pathnames for Win* and Unix are different. Windows: C:\home\hayest\fname Unix: /home/hayest/fname File location conventions also differ. JRE seems to support Unix symlinks but not Windows Shortcuts.

Solutions java.io.File.separator Do not hard-code pathnames. Environment variables. $HOME, $PATH, $CLASSPATH, $FRAMEEDITORSAVEPATH, etc. Your installer can easily set up more. Make user locate files (JFileChooser)

Example: Fixing filenames “images/starters/icon1.gif” or “images\\starters\\icon1.gif” should be replaced by “images” + file.separator + “starters” + file.separator + “icon1.gif” Avoid symbolic links and absolute paths. e.g. “images” needs to be replaced by “..” + file.sep + “..” + file.sep + “images” + file.sep + “starters” in a number of the demos.

Environment variables Can get a few of these with System.getProperties() Can get all from shell, but code will be highly system dependent. Runtime rt = Runtime.getRuntime(); Process proc = rt.exec(“set”); //…code to grab output from process… Demo code

RunTime and System System provides a system-independent way of accessing system resources, but is very limited.System Runtime lets you execute OS commands, and fiddle with the Java Interpreter and Java Virtual Machine. You should minimize and encapsulate this code to retain some portability.Runtime

The Runtime Object

“System calls” Get the Runtime instance (there can be only one). Runtime rt = Runtime.getRuntime(); Call an exec method. This returns a Process object and may throw an IOException.exec Monitor the returned Process.Process

Runtime Example Runtime.getRuntime() gets the Runtime object. exec() creates a Process object. Wrap the InputStream produced by the Process object, then use read*() methods to read the input. waitFor(), destroy() methods available.

Shells A tool for low-level OS control. High-level conveniences, such as variables, job control, automatic completion, scripting. Downside: steep learning curve, ugly. Perfect candidate for a GUI!

Shell --> WinDohs 101 Goal: Ability to open and close directories, and to view files and their properties. Shell normally lets you into only one directory at a time; this doesn’t make sense for our GUI. Each window can display the contents of a directory. When to refresh?

Oh no! We must be experts at using the File, System, and Runtime objects. We must be experts on the shell. We must be experts on the OS. We must be experts on GUI’s. We must be crazy!

Don’t Panic! Basically, our job is translation. The shell will do all the really hard work. Plenty of help out there for the asking. We have already learned most of what we need.

AbstractButtons (JVM) Runtime interacts with runs creates User WinDohs DirectoryFrame User creates invokes Process creates data

FolderSelector Done Quit Cancel click on refresh button or refresh timer event. check permissions exec(“ls”) display output if ok create desktop bring up FolderSelector QuitDialog Start click on directory name check permissions open and refresh a new window if ok

Summary Work on FrameEditor! Study the Demos Course Project Specs TBA this week