• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Differences between Running in Applets Eclipse and Browsers?

 
Chris Baty
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,
I'm working on a JAVA application that can also run as an Applet. The applet reads a text/asci file than makes adjustments based on that read. The Applet runs as expected in Eclipse but when I open the html page containing the Applet it doesn't appear to read the file. I put the text file in the same directory as the Applet:


The security policy file is:


I thought that the browser might be caching the Applet but clearing the cache didn't help.

Any thoughts would be appreciated.

Thanks.

Chris
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Policy files are not a good way of granting permission to applets, since you can't tell the applet JVM which policy file to use at runtime - it will just use the standard policy file that comes with the JRE. So unless you modify that file (which I would advise against), this approach won't work. The solution would be to sign the applet; see HowCanAnAppletReadFilesOnTheLocalFileSystem for details.
 
Paul Clapham
Sheriff
Posts: 21554
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, don't rely on knowing what the current working directory is in an applet. Although one thing you can be certain of is this: it won't even be on the same computer as the applet in real life.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic