• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Outputing files using wrapped FileWriter

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've been testing out outputing a log-type file using a FileWriter, wrapped as follows:

Then I'm using the output methods and .

When I try to call these methods from my applet, my appletviewer log says that the file write permission was denied. However, calling the same methods from a console app ...public static void main(String args[])...I can do this.

So can does java only allow file write permission from a console-based app?

I'mv ery new; explain plz!! Thanks guys!!
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Would you like to visit a web site with an applet on the page, and have that applet overwrite kernel32.dll -- or upload copies of all your .doc files to a server in Romania?

Applets are denied access to the file system (and many other resources) by default, and are granted access only according to a detailed security policy including digital signatures. This is not a topic for a beginner -- come back and worry about it a little later, after you've got some more Java experience.
 
Ryan Smith
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Lol, I guess not! So should I re-write my applet, for now at least, to be a console app?
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That depends entirely on your target user and the uses of the program.

With an Applet, it's pretty easy to "push" the latest and greatest version of the program to your users - just replace the class file(s) on the web server that serves the Applet. Is this an important feature for what you're trying to develop? If it is, note that you might want to check out the Java Web Start technology, which can do a similar thing for stand-alone applications.
 
Ryan Smith
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh...this will not be a web-based applet, simply distributed to be run on user's own computers...the output log will appear on their computer for their won personal use - it will not be written to the server
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In that case, a stand-alone application would probably fit the bill nicely. You may want to package it as an executable JAR file.
 
Ryan Smith
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yay! Exactly what I was looking for! Jar it up!
reply
    Bookmark Topic Watch Topic
  • New Topic