Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Writing to a text file contained in the jar?

 
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Rancher
Posts: 43016
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.)
 
Sunglasses. AKA Coolness prosthetic. This tiny ad doesn't need shades:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic