Campbell Ritchie wrote:What makes you think that code causes the StaticClassTest class to be loaded? It loads the Class<StaticClassTest> class and creates an instance of it. Try Class.forName("StaticClassTest");
Usha Viswanathan wrote:. . . . . .
Campbell Ritchie wrote:By static block, you probably mean a static initialiser.You can't call it. A static initialiser is called once, when the class is loaded, and never again. It is no more possible explicitly to call it than it is to call a constructor on a extant object.
Campbell Ritchie wrote:Look in the Jaa™ Tutorials. That says,You are going to have to find the individual files an copy them. Alternatively, unless the files are small, find out how to open a channel between the two directories. I have forgotten how to myself.
. . . The copy fails if the target file exists, unless the REPLACE_EXISTING option is specified.
Directories can be copied. However, files inside the directory are not copied, so the new directory is empty even when the original directory contains files. . . .
Dave Tolls wrote:As the docs for the renameTo method say:
Many aspects of the behavior of this method are inherently platform-dependent: The rename operation might not be able to move a file from one filesystem to another, it might not be atomic, and it might not succeed if a file with the destination abstract pathname already exists.
Liutauras Vilda wrote:As mentioned, if you open file upon login and only close (if at all) upon logout, the problem arise when program quits abruptly, that means you don't close file at all or you don't write at all depending how you programmed. Well, it has been mentioned earlier, we don't know what you are doing since we never saw the code.
You still can try such way:
1. User logs in -> open file -> write login info -> close file
2. User does something else -> open file -> append some extra info -> close file
4. IF program quits abruptly, you still have the file with some content. Now whether it is enough for your next login or no - I don't know.
Liutauras Vilda wrote:
Usha Viswanathan wrote:Sometimes, if the Windows gets hung, user is performing hard shutdown and at this time, the data gets erased away.
Perhaps you are sort of writing file for an entire app-use lifetime and close file if ever just upon logout.
Why you don't use database to persist such information?
Liutauras Vilda wrote:
Usha Viswanathan wrote:During the write process of xml file, when this shutdown happens, the xml file becomes blank
Cambell was asking, but you didn't explain yet, why and when file gets blank in the first place if the shutdown went abruptly?
Please explain, when file gets written with content and when the content gets deleted in normal conditions?