• 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: 42970
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: 21972
36
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.
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!