Applet Problems - Works in appletviewer but not ie

Discussion in 'Java' started by michael.rygh@gmail.com, Dec 14, 2005.

  1. Guest

    I finished the applet and everything works in using the applet viewer.
    When I open the htm file that opens the java class, everything works
    until I get to my high scores screen. when I click that button, It
    reads from a file and sorts out the high scores and then compares to
    the current users high score. nothing is written to a file. just read.

    I am wondering why it wouldn't work in the htm file but would work
    using appletviewer. If I make it a signed applet will it work? I
    thought it didn't have to be signed if you are just reading from a file
    not writing.

    Anyone have any suggestions?
     
    , Dec 14, 2005
    #1
    1. Advertising

  2. Dag Sunde Guest

    <> wrote in message
    news:...
    >I finished the applet and everything works in using the applet viewer.
    > When I open the htm file that opens the java class, everything works
    > until I get to my high scores screen. when I click that button, It
    > reads from a file and sorts out the high scores and then compares to
    > the current users high score. nothing is written to a file. just read.
    >
    > I am wondering why it wouldn't work in the htm file but would work
    > using appletviewer. If I make it a signed applet will it work? I
    > thought it didn't have to be signed if you are just reading from a file
    > not writing.


    Yes, you need to sign it to do *any* file access.

    If not, you would be able to read my
    "passwors_and_pincodes.txt" file in my root folder... ;-)

    Read or write doesn't matter.

    --
    Dag.
     
    Dag Sunde, Dec 14, 2005
    #2
    1. Advertising

  3. Guest

    Thanks Dag Sunde for the help.

    ok i've signed other applets but this one isnt working.

    either something isnt working or im forgetting something...

    i gotta jar my class..

    jar cvf quiz.jar quiz.class

    then run my key tool...

    keytool -genkey -alias quiz -validity 365

    then enter all my info

    then last i need to sign the jar file with the jarsigner

    jarsigner quiz.jar quiz

    is that all i need to do? i did all that and tried recompiling and it
    didnt work. i went and deleted my keyfile and retried it and it still
    didn't work.

    I'm new to this so any help would be great if im missing anything.
    Thanks.
     
    , Dec 14, 2005
    #3
  4. Dag Sunde Guest

    <> wrote in message
    news:...
    > Thanks Dag Sunde for the help.
    >
    > ok i've signed other applets but this one isnt working.
    >
    > either something isnt working or im forgetting something...
    >
    > i gotta jar my class..
    > jar cvf quiz.jar quiz.class
    >
    > then run my key tool...
    > keytool -genkey -alias quiz -validity 365
    > then enter all my info


    Hmmm... It is a long time since I used a self-signed
    certificate, and I've never used keytool.
    But as far as I remember you have to create
    a "root" certificate, and import that so you become
    your own CA.

    Then you use that CA-certificate to create and sign your
    code-signing certificate.
    Only now, you have a certificate you can use to sign your jar.

    The command line I use to create and sign a jar file in one shot is
    like this:

    signtool -k"My CommonName" -d. -Z"jarfilename.jar" -p"mypwd" signdir

    I have alway used OpenSSL to create self-signed server certificates,
    not code-signing. I use a commercial Verisign certificate for that.

    Anyway, here's the process for OpenSSL:
    http://www.dylanbeattie.net/docs/openssl_iis_ssl_howto.html

    Maybe you can get something from that...

    --
    Dag.
     
    Dag Sunde, Dec 15, 2005
    #4
  5. Guest

    well i got it to work. and now when i click the high scores button. it
    crashes the whole window.

    i have it just quiz.htm and it crashes that window

    and i uploaded it to my ftp and went to that website and ran the signed
    applet and when i hit the "high scores".. it crashes the whole window
    and closes it.

    i guess im stuck and don't know what would cause that. any
    suggestions/ideas would be appreciated. thanks for your time!
     
    , Dec 15, 2005
    #5
  6. Guest

    well i found out why it crashes and i got it to stop but now i still
    have a problem.

    in my catch for reading from the file... some how it would throw and
    error and my code has it do a system.exit if it does.

    so now i removed the system.exit... and when it displays the high
    scores... it just says null 0. cause obviously its not reading them..

    i just dont understand how it worked through appletviewer but not
    worked through regular html file. hmm.. thanks for the help!
     
    , Dec 15, 2005
    #6
  7. Dag Sunde Guest

    <> wrote in message
    news:...
    > well i found out why it crashes and i got it to stop but now i still
    > have a problem.
    >
    > in my catch for reading from the file... some how it would throw and
    > error and my code has it do a system.exit if it does.
    >
    > so now i removed the system.exit... and when it displays the high
    > scores... it just says null 0. cause obviously its not reading them..
    >
    > i just dont understand how it worked through appletviewer but not
    > worked through regular html file. hmm.. thanks for the help!


    In Appletviewer, it is running as a local program, accessing files
    locally.

    How do you access the file you try to open? Post the file-reading
    code.
    How is your filename and path formatted?

    --
    Dag.
     
    Dag Sunde, Dec 15, 2005
    #7
  8. wrote:

    > in my catch for reading from the file... some how it would throw and
    > error and my code has it do a system.exit if it does.


    You cannot do a System.exit(n) form within an applet.
    >
    > so now i removed the system.exit... and when it displays the high
    > scores... it just says null 0. cause obviously its not reading them..


    Where is your applet? Give us the URL so we can see it
    crash. Link to the code.

    > i just dont understand how it worked through appletviewer but not
    > worked through regular html file. hmm.. thanks for the help!


    Could be due to a number of things.

    --
    Andrew Thompson
    physci, javasaver, 1point1c, lensescapes - athompson.info/andrew
     
    Andrew Thompson, Dec 16, 2005
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Steve Claflin
    Replies:
    0
    Views:
    467
    Steve Claflin
    Sep 3, 2003
  2. Archana
    Replies:
    1
    Views:
    1,386
    Andrew Thompson
    Oct 25, 2004
  3. F. GEIGER
    Replies:
    3
    Views:
    776
    F. GEIGER
    Aug 6, 2004
  4. Replies:
    1
    Views:
    540
    Andrew Thompson
    Feb 4, 2007
  5. jeffbruce
    Replies:
    1
    Views:
    2,275
    travishein
    Aug 22, 2008
Loading...

Share This Page