[Bluej-discuss] What are the limits of synchronisation between BlueJ and Netbeans BlueJ edition?
Michael Kölling
M.Kolling at kent.ac.uk
Thu Sep 6 11:58:28 BST 2007
Hi Hedley,
Using BlueJ and NetBeans together should usually work reasonably
well. Some more comments below. (The explanations are longer than
probably necessary, but maybe knowing properly what goes on might
help. Or at least be mildly interesting...
On 3 Sep 2007, at 13:39, Hedley Finger wrote:
>
> Generally I use Netbeans to write the code and BlueJ to run and debug
> it. But there are a few funny little quirks that irks. For example,
> after using Netbeans if a class source file is opened in BlueJ it
> complains about missing files because of a crash and suggests that I
> rename a backup file as the latest version. Trouble is, if the error
> message is ignored and the file is opened it is completely okay.
When BlueJ saves files, it does so carefully so that data cannot be
lost, even if something goes terribly wrong in the middle of writing
a file. For example, assume you have a class "Dog". This will be
stored in a file "Dog.java". If you make modifications to this class
in the editor and then save, this is what happens:
- Dog.java is copied to Dog.java# (the "crash file")
- the modifications are saved to Dog.java
- if the preference option to create file backups is on, Dog.java#
is renamed to Dog.java~ (the "backup file"), otherwise Dog.java#
is deleted
This ensures that there is always a consistent version of the file on
disk. In normal operation, the crash file is always temporary and
should never remain.
When opening a class, we check whether the crash file exists. This
would indicate a fatal problem during saving. Dog.java may now be
invalid (or it may not - we don't know), but something went wrong. We
then rename Dog.java# to Dog.java#backup (to make it more obvious
what this is) and show a message to the user to inform him/her about
this. It says that the source file _may_ be incomplete, and to check it.
This is the message you are seeing.
Reasoning back from this, we can assume that in your case the crash
file was present. If the source file is okay, then there might not
have been a problem with saving the source file, but a problem
deleting the crash file (or renaming it as a backup file if you have
the option on).
There are some things you can do:
- If you have the BlueJ preference 'Make backup of source files'
enabled, try disabling it.
- Check for the crash file manually. Check its access rights.
- Check whether a backup file exists. Then check access to make sure
it can be overwritten.
> Another thing, if a project is compiled and built in Netbeans, BlueJ
> does not appear to know about it. Even after Netbeans compilation, a
> class in BlueJ may still have its stripes, and has to be compiled
> again in BlueJ before it can be run.
That's true. That's an omission in the communication. We should add
this to the bug list.
> Another tricky area is debugging. If I set breakpoints in BlueJ,
> effectively a source file can be open in both BlueJ and Netbeans
> simultaneously. So, if I forget and edit a file in BlueJ, is the
> view of that file in Netbeans supposed to update? I have a feeling
> that I saw an open file in BlueJ update when the same file was edited
> in Netbeans.
Yes, they should both update when changed in the other system (but
you may have to click into the editor to activate it to trigger the
update).
> Is the practice of using both IDEs simultaneously dangerous? BlueJ
> is cool for debugging because you can run any method on its own and
> study the variables in the Inspector. But Netbeans is also cool
> because of its neat code completion and cursor-tip display of the
> relevant class documentation.
Yes, you're quite right - we thought that too. We tried to make this
possible, exactly as you are trying to use it.
> If I put them both in a pot and stew for an hour, will I get an IDE
> that combines the best of both? If only ...
Who knows...
mik
More information about the bluej-discuss
mailing list