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.

Slides:



Advertisements
Similar presentations
17 Copyright © 2005, Oracle. All rights reserved. Deploying Applications by Using Java Web Start.
Advertisements

NIMAC 2.0: The Accessible Media Producer Portal NIMAC 2.0 for AMPs.
Programming with Android: SDK install and initial setup Luca Bedogni Marco Di Felice Dipartimento di Informatica: Scienza e Ingegneria Università di Bologna.
Java State Exploration Tool Mike Lawson CS522 Fall 2004.
Csci5233 Computer Security1 GS: Chapter 6 Using Java Cryptography for Authentication (Part B)
Creating Jar Files Jin Hung, Gregory Olds, George Blank, Sun Java Web Site.
CSc 667/867 Java Web Start / JNLP RSS. Deploying Software with JNLP and Java Web Start Delivering client-side Java technology-based programs has recently.
Java Network Launch Protocol (JNLP) Tomas Bober. What it is A clever way to manage the contents of your java applications on a client’s computer. If you.
Coursework 2: getting started (4) – using PhoneGap to build mobile applications (optional) Chris Greenhalgh G54UBI /
Java Chapter 22 - Student. Why Java? ADVANTAGESDISADVANTAGES Has _____________ capabilities__________ ( times) than languages compiled directly.
CASE STUDY: Applet Development with GUI and Client-side File Input Arkadiusz Edward Komenda.
Views Dwight Deugo Nesa Matic
Creating and Publishing Your own website
RIMS II Online Order and Delivery System Tutorial on Downloading and Viewing Multipliers.
עיצוב תוכנה מונחה עצמים תירגול 1. 1.Packages and Paths 2.Jar Files Outline.
Computers as an Expressive Medium Lab 8: jar signing, debugging Mayhew Seavey.
IPad Lab use  See your office Secretaries for Reserving the IPad Labs.  After use, do not allow the students to put the IPads away, the connectors are.
Laboratory Exercise # 3 – Basic File Management Office Productivity Tools 1 Laboratory Exercise # 3 Basic File Management Objectives: At the end of the.
1 Lecture 5 George Koutsogiannakis/ Summer 2011 CS441 CURRENT TOPICS IN PROGRAMMING LANGUAGES.
Lab 8 – C# Programming Adding two numbers CSCI 6303 – Principles of I.T. Dr. Abraham Fall 2012.
J2EE Web Fundamentals Lesson 1 Introduction and Overview
Eucalyptus Virtual Machines Running Maven, Tomcat, and Mysql.
Java How to Program, 9/e © Copyright by Pearson Education, Inc. All Rights Reserved.
Creating Web Pages Overview. Design – Start with a Purpose Before you start any web page, you need to design the website. The first question that should.
Connecting to USF Network for Web Site SSH Secure Shell is the FTP program you will use to download your http files onto the USF server. To get the SSH.
Copyright© Jeffrey Jongko, Ateneo de Manila University Android.
CS441 CURRENT TOPICS IN PROGRAMMING LANGUAGES LECTURE 5_1 George Koutsogiannakis/ Summer
ENTERING ELIGIBLE ENERGY RESOURCE APPLICATIONS IN DELAFILE Version 2.0 August 25, 2015.
Guidelines for Homework 6. Getting Started Homework 6 requires that you complete Homework 5. –All of HW5 must run on the GridFarm. –HW6 may run elsewhere.
Deploying Java applications as JAR files SE-2030 Dr. Rob Hasker 1 Based on material by Dr. Mark L. Hornick.
1 Introduction to Applets. 2 Applications Programs that execute using the java interpreter Executes in command windows.
CPSC 203 Introduction to Computers Lab 23 By Jie Gao.
HTML Hyper Text Markup Language A simple introduction.
How to publish your app 1 CS440. Step 1: Remove any debug logging  Good practice: comment out any debug logging  Why? CS440 2.
Unit 2, cont. September 12 More HTML. Attributes Some tags are modifiable with attributes This changes the way a tag behaves Modifying a tag requires.
1 ITI 1120 Lab # 1 An Introduction to the Lab Environment Contributors: G. Arbez, M. Eid, D. Inkpen, A. Williams, D. Amyot.
SharePoint document libraries I: Introduction to sharing files Sharjah Higher Colleges of Technology presents:
MyBLAST standalone installation Lab of Systems Biology & Network Biology website Download link. 1.Click the Download link.
WHAT IS FTP? FTP (File Transfer Protocol) is a known effective and organized way of transferring files over the internet directly from one computer to.
Forms and Server Side Includes. What are Forms? Forms are used to get user input We’ve all used them before. For example, ever had to sign up for courses.
1 Creating an RTC Hot Fix September 18, Steps for creating a hot fix Find the work item where the defect is resolved. Check for existing hot fixes.
Proprietary & Confidential Java WebStart Created by Bob Hays.
Ant & Jar Ant – Java-based build tool Jar – pkzip archive, that contains metadata (a manifest file) that the JRE understands.
Packaging for Voracity Solutions Control Panel David Turner.
What is a port The Ports Collection is essentially a set of Makefiles, patches, and description files placed in /usr/ports. The port includes instructions.
Csci5931 Web Security1 Java Security Model (GS: Ch. 7)
IT tools to communicate By Suleman Kalam. Podcast What is Podcasts? A podcasts is a downloadable media file which can be downloaded into many electronic.
Java Security Session 19. Java Security / 2 of 23 Objectives Discuss Java cryptography Explain the Java Security Model Discuss each of the components.
Accessing the Lab. Putty Available via links on course page Creates secure (SSH) command line session between your machine and SCS network Uses tunnelling.
Getting Started Introduction Section 0 Lecture 1 Slide 1 Section 0 Slide 1 INTRODUCTION TO Modern Physics PHYX 2710 Fall 2004 Intermediate Lab Fall.
1 MSTE Visual SourceSafe For more information, see:
Eclipse Project. Installing Visit to download a copy for your home computerhttp:// –Get Release version 3.0 (or.
CIS Intro to JAVA Lecture Notes Set July-05 GUI Programming –TextField Action Listeners, JEditorPane action listeners, HTML in a JEditorPane,
Building Packages BCIS 3680 Enterprise Programming.
Jar Files The Basics. 2 Outline Create a Jar Viewing the Contents of a JAR File Extracting the Contents of a JAR File Modifying a Manifest File Running.
PROG Object Oriented Programming II PROG Object Oriented Programming II Application Deployment.
Intro to APACHE, MySQL, and PHP & freely available (hackable) Packages Aonghus Sugrue 04 Oct 2012.
Virtual Machines Module 2. Objectives Define virtual machine Define common terminology Identify advantages and disadvantages Determine what software is.
LAB#8 PKI & DIGITAL CERTIFICATE CPIT 425. Public Key Infrastructure PKI 2  Public key infrastructure is the term used to describe the laws, policies,
GOOGLE PLAY By William Cook April 14, GOOGLE PLAY Marketplace for apps for android Androids “app store” You must make an account on the developer.
Development Environment
Chapter 23 Applets and Java Web Start
Outline Install Java Change Security Files in Java
FTP and UNIX TOPICS Exploring your Web Hosting Site FTP UNIX
Arden University FTP Induction Resource
JavaTeaching and Importing a github repository
Most Common Grading Issues
Macrosystems EDDIE: Getting Started + Troubleshooting Tips
Presentation transcript:

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 Limitations of CD fixed size fixed size classes are fixed classes are fixed java vm requirement fixed java vm requirement fixed Granny can't run it in DesMoine Granny can't run it in DesMoine Maybe Granny likes to save money and use the library computer Maybe Granny likes to save money and use the library computer

(JAR) Java ARchive files based on pkzip (rename from boo.jar to boo.zip and it becomes a zip file) based on pkzip (rename from boo.jar to boo.zip and it becomes a zip file) holds: holds: class files class files information about the contained files information about the contained files can hold other stuff, like gifs! can hold other stuff, like gifs! Best of all Best of all can be made executable can be made executable application runs out of the jar file application runs out of the jar file don't have to unjar (unpack) it don't have to unjar (unpack) it

Example: SimpleGui.jar I have a project, called Gift I have a project, called Gift c:\Gift is the directory c:\Gift is the directory I have a package, called cs201 I have a package, called cs201 c:\Gift\cs201 is the directory containing: c:\Gift\cs201 is the directory containing: SimpleGUI.java SimpleGUI.java SimpleGUI.class SimpleGUI.class Olsson001.gif Olsson001.gif

Jar options (complete list at end of slides) jar –cf SimpleGUI.jar cs201 jar –cf SimpleGUI.jar cs201 create create jar –xf SimpleGUI.jar jar –xf SimpleGUI.jar extract extract jar –tf SimpleGUI.jar jar –tf SimpleGUI.jar list contents list contents

Make it executable See slides at end See slides at end need to include a file (manifest) that tells java where the main() method is need to include a file (manifest) that tells java where the main() method is jar –cvmf manifest.txt SimpleGUI.jar cs201 jar –cvmf manifest.txt SimpleGUI.jar cs201 m in –cvmf means, include the manifest file (manifest.txt) in the jar m in –cvmf means, include the manifest file (manifest.txt) in the jar

How to run the jar file double-click it double-click it or or java –jar SimpleGUI.jar java –jar SimpleGUI.jar

Trust Java security based on the Sandbox Java security based on the Sandbox we'll let you have limited access to system resources we'll let you have limited access to system resources you cannot read or write to local disk you cannot read or write to local disk you (usually) only read from the website from which you are downloaded you (usually) only read from the website from which you are downloaded can't attack other sites, e.g. can't attack other sites, e.g.

Increased security Signing a jar file Signing a jar file signifies who created it signifies who created it somewhat informal somewhat informal you can spend $$ for a certificate you can spend $$ for a certificate increased trust among your customers increased trust among your customers

Signing a jar Full details at end of slides Full details at end of slides 1. Create a key file 2. Add your keys to the file 3. Sign the jar file with your key 4. Only you can sign it this way 5. For greater trust, buy a certificate $$

What happens when you execute a jar file? 1. java opens the jar file and looks in a directory called META-INF 2. it finds the file MANIFEST.MF this was created from your manifest.txt file this was created from your manifest.txt file 3. looks to see where the main() method is Main-Class: cs201.SimpleGUI Main-Class: cs201.SimpleGUI knows to look in the cs201 package directory (in the jar file) knows to look in the cs201 package directory (in the jar file) look for the class SimpleGUI look for the class SimpleGUI call the main() method inside of SimpleGUI call the main() method inside of SimpleGUI

We can also include images, sounds, in the jar file Details shown at end: Details shown at end: 1. put the file in your package 2. use a URL to access the file

WebStart - STDGOADK Your app lives on the web Your app lives on the web You download it to your machine You download it to your machine It executes on your machine It executes on your machine Makes sure your version is up to date Makes sure your version is up to date can fetch updates can fetch updates get fetch newer versions of the runtime system, etc. get fetch newer versions of the runtime system, etc.

Web Start overview create executable jar file create executable jar file sign it sign it create a JNLP file create a JNLP file create an html file create an html file put all this on a website put all this on a website

JNLP – java network launching protocol web-centric web-centric "codebase" is on web, not users disk "codebase" is on web, not users disk something like running: something like running: java –classpath UI.jar cs201.SimpleGui java –classpath UI.jar cs201.SimpleGui UI.jar UI.jar uses a JNLP file to guide the fetch and run uses a JNLP file to guide the fetch and run provides secure running (unless your user gives permission) provides secure running (unless your user gives permission)

JNLP file xml – oh boy xml – oh boy specifies jar file specifies jar file the java runtime the java runtime any optional packages any optional packages system properties system properties URLs pointing to any resources (images, sounds, etc) URLs pointing to any resources (images, sounds, etc) name of html file pointing to us name of html file pointing to us our name (i.e., SimpleGUI.jnlp) our name (i.e., SimpleGUI.jnlp)

Need a web page, too Either put into your index.html or something as simple as: Simple GUI WebStart Application Simple GUI WebStart Application</a> Put into the file reference by the jnlp file

put all of this on a web page i.e., in the public_html directory of your home directory file share i.e., in the public_html directory of your home directory file share SimpleGUI.jar SimpleGUI.jar SimpleGUI.jnlp SimpleGUI.jnlp index.html index.html

Run it via WebStart or click on the link or click on the link UI.jnlp UI.jnlp

WebStart

Including the.gif in your project right click on the project right click on the project import import file system file system next next import from a directory like c:\localdata import from a directory like c:\localdata

importing a gif into project you will see a list of all files you will see a list of all files select Olsson001.gif select Olsson001.gif

importing a gif into project This will put file in your project. This will put file in your project. You drag it to the package You drag it to the package in this picture, I've already done so in this picture, I've already done so importing a gif into project importing a gif into project

jar files from Eclipse export export jar file jar file select the resources select the resources give it a name, like SimpleGUI.jar give it a name, like SimpleGUI.jar next look at packaging options (doesn't matter) next look at packaging options (doesn't matter) next, generate a manifest file and specify the main() class: e.g.:cs201.SimpleGui next, generate a manifest file and specify the main() class: e.g.:cs201.SimpleGui click on finish click on finish

Jar options Shown on next slides Shown on next slides

Jar options jar –cf SimpleGUI.jar cs201 jar –cf SimpleGUI.jar cs201 -c means "create a jar" -c means "create a jar" f means "with the file name" f means "with the file name" SimpleGUI.jar is the name of the jar file SimpleGUI.jar is the name of the jar file cs201 is the package directory that will be put into the jar cs201 is the package directory that will be put into the jar

Jar options jar –xf SimpleGUI.jar jar –xf SimpleGUI.jar -x means "extract a jar" -x means "extract a jar" f means "with the file name" f means "with the file name" SimpleGUI.jar is the name of the jar file SimpleGUI.jar is the name of the jar file Will extract the contents of the jar file (i.e., create the cs201 package directory and all the files therein)

Jar options jar –tf SimpleGUI.jar jar –tf SimpleGUI.jar -x means "extract a jar" -x means "extract a jar" t means "display the contents" t means "display the contents" SimpleGUI.jar is the name of the jar file SimpleGUI.jar is the name of the jar file Will list contents of jar file

Executable jar files with packages assume same set of class directories assume same set of class directories c:\Gift\cs201 is the package directory c:\Gift\cs201 is the package directory go to top level directory go to top level directory cd c:\Gift cd c:\Gift create a manifest file, manifest.txt, that tells us where the main() method is to be found create a manifest file, manifest.txt, that tells us where the main() method is to be found Main-class: cs201.SimpleGUI Main-class: cs201.SimpleGUI put manifest.txt in c:\Gift put manifest.txt in c:\Gift create the executable jar file create the executable jar file jar –cvmf manifest.txt SimpleGUI.jar cs201 jar –cvmf manifest.txt SimpleGUI.jar cs201 m in –cvmf means, include the manifest file (manifest.txt) in the jar m in –cvmf means, include the manifest file (manifest.txt) in the jar

Signing a Jar file, part I keys keys create a keystore to hold your keys create a keystore to hold your keys keytool -genkey -keystore newKeys -alias team99 keytool -genkey -keystore newKeys -alias team99 generates a keystore called myKeys and adds a holder cwm2n generates a keystore called myKeys and adds a holder cwm2n prompt you for the password (echoes to screen)! prompt you for the password (echoes to screen)! Your name, organization, city, state, etc. Your name, organization, city, state, etc. keytool -selfcert -alias team99 -keystore newKeys keytool -selfcert -alias team99 -keystore newKeys -selfcert – informal -selfcert – informal -alias team99 who is signing this -alias team99 who is signing this -keystore where to put the keys -keystore where to put the keys keytool -list -keystore newKeys keytool -list -keystore newKeys how to see your keys how to see your keys

Signing a Jar file, part II use jarsigner use jarsigner jarsigner -keystore myKeys SimpleGUI.jar cwm2n jarsigner -keystore myKeys SimpleGUI.jar cwm2n

How to access gifs, sounds in the jar file Suppose is want to open a file in a method of the class SimpleGUI Suppose is want to open a file in a method of the class SimpleGUI ImageIcon img= new ImageIcon("Olsson001.gif"); ImageIcon img= new ImageIcon("Olsson001.gif"); Since jar file is running from the c:\Gift directory, might not find the.gif file Since jar file is running from the c:\Gift directory, might not find the.gif file Do we put Olsson001.gif in c:\Gift Do we put Olsson001.gif in c:\Gift if we do, and jar it up, this still does not work since Olsson001.gif is not in the c:\Gift directory if we do, and jar it up, this still does not work since Olsson001.gif is not in the c:\Gift directory

How to access gifs, sounds in the jar file Package to the rescue! Package to the rescue! put Olsson001.gif in cs201 package directory put Olsson001.gif in cs201 package directory change statement to: change statement to: ImageIcon img= new ImageIcon("cs201/Olsson001.gif"); ImageIcon img= new ImageIcon("cs201/Olsson001.gif"); Now, java knows to look in the package cs201 inside the jar file Now, java knows to look in the package cs201 inside the jar file Works! Works!

How to access gifs, sounds in the jar file URL to the rescue! URL to the rescue! keep Olsson001.gif in cs201 package directory keep Olsson001.gif in cs201 package directory change statements to: change statements to: URL url = SimpleGUI.class.getResource("Olsson001.gif"); URL url = SimpleGUI.class.getResource("Olsson001.gif"); Image img= Toolkit.getDefaultToolkit().getImage(url); Image img= Toolkit.getDefaultToolkit().getImage(url); need import java.net.*; need import java.net.*; Now, java knows to look in the package cs201 inside the jar file Now, java knows to look in the package cs201 inside the jar file Works! Works!

JNLP file specifics line by line follows this slide line by line follows this slide

Line by line look at JNLP file using xml version 1 and the encoding we'll use using xml version 1 and the encoding we'll use

Line by line <jnlp spec="1.0" codebase=" m2n" href="SimpleGUI.jnlp"> version of jnlp to use version of jnlp to use codebase is where the code lives codebase is where the code lives last line is required, seems redundant but useful if installed on desktop last line is required, seems redundant but useful if installed on desktop

Line by line <information> Simple GUI App Simple GUI App</title> CS201 Teams Rule! CS201 Teams Rule!</vendor> Simple GUI webstart demo Simple GUI webstart demo <offline-allowed/></information>

Line by line <security> </security> Dangerous! Dangerous! you are asking for carte blanche you are asking for carte blanche read files, write files, read clipboard, etc. read files, write files, read clipboard, etc. user will allow this, even if you have written poor code (and erase her disk!) user will allow this, even if you have written poor code (and erase her disk!)

Line by line <resources> </resources> which version of java to use which version of java to use which executable jar file which executable jar file can include things like sounds and images can include things like sounds and images

Line by line <application-descmain-class="cs201.SimpleGUI"/> Like the manifest file, tells which class has a main() method

putting it all together <jnlp spec="1.0" codebase=" Simple GUI App Simple GUI App cwm2n cwm2n Simple GUI webstart demo Simple GUI webstart demo <security> </jnlp>