This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Applets and the fly likes Writing to a text file contained in the jar? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Writing to a text file contained in the jar?" Watch "Writing to a text file contained in the jar?" New topic
Author

Writing to a text file contained in the jar?

James Hodgkiss
Ranch Hand

Joined: Jan 22, 2004
Posts: 401
My jar includes a text file to store persistent data.

I understand my applet can read from that text file without needing any signing or security policy changes, but is it possible for my applet to write to the same text file without needing any signing or security policy changes?

Would have thought this would be a safe operation, but haven't seen anything yet that suggests it's possible...

By the way, I am using JDK1.1.

Cheers,
James
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41155
    
  45
The applet can read from that file because it's in the classpath. That mechanism for accessing resources through the classlaoder can't be used for writing.

Even if it was possible, then the file would still be on the server, and there are no provisions to enable an applet to write to a server without some intervening server code such as a servlet.

(As a side note, the java.util.jar package does not allow the modification of jar files, just reading and creating them.)


Ping & DNS - my free Android networking tools app
 
 
subject: Writing to a text file contained in the jar?
 
Similar Threads
Signed applet getting access denied
How do I make applet that uses system event queue work in the browsers?
RMI using Applet
Applet does not reflect the changes in (compiled) source code
Breaking Java WebStart Security