• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
Bartenders:

First time applet

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey there guys,

I am in the process of the creating my first applet . I have run into a problem though. I can run the applet through eclipse and the applet viewer pops up, says applet loaded, and my program starts(this was initially an application i have been transferring to applet). When it loads from eclipse, it connects, selects, inserts, and deletes to the database perfectly. However, and this could definitely be from me doing something incredibly basic wrong, when i run it through a html file i made with a reference to appletName.class, the browser window pops up, and nothing else.

I did however right click on the java icon and pulled up this error from the log:
Exception: java.security.AccessControlException: access denied (java.util.PropertyPermission file.encoding read)

Now obviously that isnt the whole error log, but it seemed like it was the most important. It appears to me, that it has something to do with my MySql database connecting. I did look up some information online, and many suggest to update my .policy file. Now, i don't know if this is a good idea or not, but i really have no clue what it means in the first place.

Any help with this would be really helpful, and i would truly appreciate it.
Also, i have hopes of running this off a a server for the place i work at, in order to allow everyone to have access through the browser by typing in something like- ip:port:file.

Thanks again, if anyone is willing to help and would like some more information ( i didnt really know what was all- too important, and all-not, as im not familiar with applets) i will do so asap.

 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Applets are not allowed to do a number of things, including file I/O and various networking tasks; it would seem that your applet is trying to do one of these. You may need to sign it: https://coderanch.com/how-to/java/HowCanAnAppletReadFilesOnTheLocalFileSystem
 
Joe Meany
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you very much! I tried looking around, but because I didnt really know what was going on, it was hard to find any answers.

Thanks for the great link!
 
Marshal
Posts: 27996
94
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would have used "applet access denied" for my Google keywords, and I'm pretty good at finding things on the web. Was that anything like what you tried?
 
Joe Meany
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, i just typed in the error message..and i got results. Well, i got peoples suggestions, but i couldnt find what it really meant. that above link is very informative, but i hadnt realized this process was so complicated
 
Joe Meany
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, so i am still having some trouble with this and was hoping for a bit more direction(sorry).
Now, when i run my applet through google chrome, i get a bar at the top that says it needs my permission to run, i allow it, but nothing happens. I opened up the console again to see the same error message, ill post the whole thing now:


If anyone has any suggestions i would greatly appreciate it. I am not sure if my certificates are working right. I followed the links above, but there were some situations where it got a little hairy, and i wasnt sure of what the tutorial wanted me to do. I also was looking up how to have a policy file allow for all permissions but i don't want to play with something i am unsure of.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Don't go the policy file route - you can't expect random users of your applet to be able or willing to fiddle around with those.

Yes, it looks like the applet code is not signed correctly (or at all), or possibly the code in question needs to be run as privileged code (also described in the link I posted earlier).
 
Joe Meany
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oops, i hid my console window on accident. Alright, thank you for all of your responses Ulf, really appreciated.
 
Joe Meany
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey there,

Sorry to keep adding to this thread.. but im still having one heck of a time with this.

So, ill start from the beginning:
1)exported jar
2)signed jar
3)created certificate
4) Doesnt work

Browsers on other machines dont even prompt for certificate authentication...they just error out in the console again(same error as before)
So, im really not so sure what is wrong with this anymore. From what ive read online, if i self-sign my applet... dont i have to import that certificate onto everyones machine who will be running this?

Is there a good way to do what i want to do other than with an applet(maybe throwing it on an application server?)

Again, i apologize i am pretty new to applets... but i would love to see this work.

Any suggestions(or pointers at what i am probably doing wrong) would be great! thank you!
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

1)exported jar
2)signed jar
3)created certificate


How can you sign anything before creating a certificate? How are you using the keytool and jarsigner tools?

From what ive read online, if i self-sign my applet... dont i have to import that certificate onto everyones machine who will be running this?


No. The certificate is part of the signed jar files.
 
Joe Meany
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok, im sorry about that, let me bring up the "applet signing tutorial" i was looking at and do this better....

alright:

1) package applet into jar file(using eclipse)
2)create a pblic/private key pair using: keytool-genkey
3)create a certificate using: keytool -selfcert
4)run jarsigner -keystore jarFile.jar key

I *think* this is how i am supposed to do it. Sorry if my explanation was rash.

And thanks again for your help with this. Youre pretty super.
 
"How many licks ..." - I think all of this dog's research starts with these words. Tasty tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic