File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Outputing files using wrapped FileWriter

 
Ryan Smith
Ranch Hand
Posts: 40
  • 0
  • Mark post as helpful
  • send pies
  • 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!!
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24204
34
Chrome Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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?
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yay! Exactly what I was looking for! Jar it up!
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic