Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

want to see my applet in browser -- reading a file

 
Charlotte Shearrill
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i would like to read from a file located on my server by way of an applet. i want this applet to run in a browser setting, preferably netscape. the applet does run from the appletviewer, but when i try to open the applet in my browser i get an error message from my browser status bar that states “Applet NameOfApplet notinited”, from my console i get the following error message: Java.security.AccessControlException: access denied (java.io.FilePermission NameOfFile read)
i have read several posts here, but i have not been fortunate enough to find one that will walk me through the process that i need to perform. where do i start?
thank you.
-- Charlotte
 
Manfred Leonhardt
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Charlotte,
What have you tried? Something like below?

Regards,
Manfred.
[ February 21, 2002: Message edited by: Manfred Leonhardt ]
 
Charlotte Shearrill
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi manfred,
thanks a bunch. i had the following lines of code (that didn't work):

this works great in IE, but what will i have to do differently to get it to work in Netscape?
thank you.
-- charlotte
 
Manfred Leonhardt
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Charlotte,
Applets can't read local files without creating a signed jar file. Read about it signing FAQ .
You can however, use the lines I gave you above to read a file located on the server in which the applet was loaded from.
Regards,
Manfred.
 
Charlotte Shearrill
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi manfred,
i am somewhat perturbed. i have created some signed applets/jar files, but i feel as if i have been pretty much shooting in the dark. i have read several post on the forums here and they are directed to some url for the most part. i have visited several of the sites and gone through tutorials, but i fear that i am missing the over all picture.
i have also visited the site that you recommended... but my efforts have availed me little.
the code that i have written was created on my local machine, i then copied the text file, the html file, the class file, the jar file over to my test server. it runs on my test server in IE so what am i not understanding about this?
thanks.
-- charlotte
 
Charlotte Shearrill
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry manfred,
i was wrong it does work in both browsers.... i didn't refresh my netscape browser.
thank you again...in a big way
-- charlotte (all kinds of warm fuzzy feelings)
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic