Computers as an Expressive Medium - PowerPoint PPT Presentation

1 / 17
About This Presentation
Title:

Computers as an Expressive Medium

Description:

Computers as an Expressive Medium. Lab 8: jar signing, debugging. Mayhew Seavey ... jar signing Not just for pottery celebrities anymore. ... – PowerPoint PPT presentation

Number of Views:41
Avg rating:3.0/5.0
Slides: 18
Provided by: mayhewse
Category:

less

Transcript and Presenter's Notes

Title: Computers as an Expressive Medium


1
Computers as an Expressive Medium
  • Lab 8 jar signing, debugging
  • Mayhew Seavey

2
This weeks episode
  • jar signing Not just for pottery celebrities
    anymore.
  • Debugging Not just for exterminators anymore.

3
This weeks episode
  • jar signing Not just for pottery celebrities
    anymore.
  • Debugging Not just for exterminators anymore.
  • And MORE crappy puns!

4
Using Web crawling on Courseware
  • Processing window extends BApplet. You can view
    Applets on the web, which is why they work
    (usually) seamlessly with the Courseware.
  • HOWEVER, browsers have security problems when a
    Java applet tries to access other files at
    different sites.

5
Using Web crawling on Courseware
  • For instance, this call works both in Processing
    and on the Courseware (provided image1.jpg is in
    your data directory)
  • BImage im loadImage(image1.jpg)
  • But this call works only in the Processing
    program, not online
  • BImage im loadImage(http//idt.gatech.edu/msea
    vey/image1.jpg)

6
Signing your jar file
  • To allow browsers to control the security of your
    applet, you must sign it first.
  • Two steps
  • Create a keystore file.
  • Sign your jar file.
  • Before you can do this, you must either
  • upload your jar file to your Steel account.
  • For the following commands, use a shell prompt.
  • install the Java SDK on your machine.
  • get to a command line in the directory of your
    jar.

7
Signing your jar file
  • Create a keystore file. Run the following
    command
  • keytool -genkey -alias -keystore
  • The -keystore part is optional. It
    allows you to specify where the .keystore file
    will go. If you dont specify, it will place it
    in your default system path. This should be fine
    for most applications.

8
Signing your jar file
  • After you run keytool, it will prompt you for
    some things
  • keystore password this is used when signing your
    jars.
  • Name, Organizational Unit, blah blah not very
    important, just provides viewers information on
    who theyre trusting.
  • key password also used when signing your jars.
    Not a problem to make it the same as the keystore
    password.

9
Signing your jar file
  • Sign your jar file. Run the following command
  • jarsigner -keystore
  • is just the file name of the jar.
  • just needs to match the alias you used
    for the keystore.
  • -keystore is also optional. The
    default will be the same location as keytool.
  • You will be prompted for your keystore password.

10
Viewing the jar file
  • The jar file is signed! Upload it to the
    courseware like you would normally.
  • When anyone loads the applet, a window will come
    up asking if they accept the certificate. Just
    click Yes, and the applet will load.

11
Debugging
  • Stack Trace The indecipherable lines of red that
    pop up when an error occurs.
  • This shows what methods were running in what
    classes when the program broke, as well as the
    line numbers in their java files.

12
Debugging
  • Common errors, and what they mean
  • ArrayOutOfBoundsException
  • You are trying to access an index in an array
    that doesnt have that index. For example,
    thisArray-1 or thisArray6 in an array with
    length 6 (max index of 5). Check to make sure any
    for loops have the right conditions.

13
Debugging
  • Common errors, and what they mean
  • NullPointerException
  • You are trying to access an object that hasnt
    been initialized, or is set to null. Remember
    that in addition to declaring a variable (telling
    the program this variable exists, has this type,
    and this name), you must initialize the variable
    (give it a value or point it at an object).
  • String myString // declares String variable.
  • myString new String() // sets variable to
    point to a String object.

14
Debugging Tips
  • Split up tasks into smaller methods. Processing
    will tell you which method the error occurred in,
    so the smaller they are, the closer you can
    pinpoint it.
  • Processing also gives you a line number. Not as
    useful when it doesnt give you a way to scroll
    to that line, but you can copy and paste your
    code into another editor (NetBeans, even
    Dreamweaver) that does have a go to line
    function.

15
Debugging Tips
  • Use println intelligently to try and figure out
    whats wrong. You can use this to keep track of
    what variables are at different points in the
    program, or even just to tell you what methods
    the program is going into. Doing this can help
    give a sense as to the flow of what is happening
    in the program.

16
End of Slides
  • Lets do some more hands-on debugging stuff.
  • Betcha thought itd be a Farscape picture this
    week, huh?

17
End of Slides
  • Lets do some more hands-on debugging stuff.
  • Betcha thought itd be a Farscape picture this
    week, huh?
Write a Comment
User Comments (0)
About PowerShow.com