aspose file tools*
The moose likes Beginning Java and the fly likes Outputing files using wrapped FileWriter Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Outputing files using wrapped FileWriter" Watch "Outputing files using wrapped FileWriter" New topic
Author

Outputing files using wrapped FileWriter

Ryan Smith
Ranch Hand

Joined: Jun 29, 2004
Posts: 40
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

Joined: Jul 08, 2003
Posts: 24184
    
  34

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.


[Jess in Action][AskingGoodQuestions]
Ryan Smith
Ranch Hand

Joined: Jun 29, 2004
Posts: 40
Lol, I guess not! So should I re-write my applet, for now at least, to be a console app?
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
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.


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Ryan Smith
Ranch Hand

Joined: Jun 29, 2004
Posts: 40
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

Joined: Dec 10, 2001
Posts: 7023
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

Joined: Jun 29, 2004
Posts: 40
Yay! Exactly what I was looking for! Jar it up!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Outputing files using wrapped FileWriter