Applet Problems - Works in appletviewer but not ie

M

michael.rygh

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?
 
D

Dag Sunde

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.
 
M

michael.rygh

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.
 
D

Dag Sunde

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...
 
M

michael.rygh

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!
 
M

michael.rygh

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!
 
D

Dag Sunde

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?
 
A

Andrew Thompson

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,810
Latest member
Kassie0918

Latest Threads

Top