[Bluej-discuss] Backup file error messages

Michael Kölling M.Kolling at kent.ac.uk
Thu Sep 13 09:25:36 BST 2007


On 13 Sep 2007, at 02:47, Hedley Finger wrote:


> I conducted the following experiment:
>
> 1       Set up a new test project from scratch.
> 2       Turn the backup files preference OFF.
> 3       Make a new class.  Change a method and compile.
> 4       Add another method and compile, then quit BlueJ.
>
>          Only a *.java file created.

Okay, all seems fine with backups off.

> 5       Turn the backup files preference ON.
> 6       Make another class, change a method and compile.
> 7       Add another method and compile, then quit BlueJ.
>
>          Created *.java, *.java# and *.java~ files.  Then the *.java#
> file became *.java#backup!  Possibly Windows Explorer slow in  
> refreshing.
>
> 8       Launch BlueJ again and double-click on the last class.
>
>          Error message about BlueJ crashing appears.

The error message is caused by the *.java# file. This is a temporary  
file that is created for safety while saving files (to ensure that  
there is always a valid file on disk) and is usually deleted  
automatically after a successful save.

If this file is found at the next startup, BlueJ assumes that the  
save went bad, and displays the error. In your case, it seems that  
the save went well, but removing the file did not work (for some  
strange reason). When BlueJ displays the error, it also renames  
*.java# to *.java#backup to make it easier to find and move the file  
out of the way of subsequent saves.

Without backups, the sequence is

   1	Copy *.java to *.java#
   2	Save editor to *.java
   3	Remove *.java#


With backups, the sequence is

   1	Copy *.java to *.java#
   2	Save editor to *.java
   3	Rename *.java# to *.java~

Now, it is very odd to have both the *.java# and *.java~ files  
present, since they really should be the same fine, which only  
changes its file name at some point...

I just tested this on MacOS, and all is fine. It may be some OS  
specific behaviour. What OS/Java version are you running?


> I often Quit all projects, leaving it to BlueJ to save files before
> it exits.  Could this be somehow different from saving each project
> before quitting?

That should not make any difference (assuming there are no bugs...).

Michael



More information about the bluej-discuss mailing list