Wednesday, August 08, 2007

Hey, what happened to my auto-indent in NetBeans?

The last few days, I have been struggling while writing code in NetBeans, because auto-indent just disappeared. I asked for help on the nbusers list but didn't see an answer.

While walking my kid in the stroller this morning, I had a moment of illumination. When I came into work, I removed my userdir, and that fixed the problem. Magic!

Actually, removing your userdir seems to be the Magic Bullet for strange NetBeans behavior. NetBeans seems to be able to get its configuration repository mixed up from time to time, and then it starts having these little psychotic episodes like no longer indenting, or badging files that compile fine, and so on.

So, what is this "userdir" of which I speak? It's the "user directory" and it contains all the configuration environment for NetBeans for a given user. And where is this beast? Take a look at this FAQ for your answers (note that on a Mac the "About" page is not under "Help" but under the bold "NetBeans" menu on the far left).

Be aware that when you remove your userdir, you lose any configurations you have set up. You will have to re-register your app server, re-install any extra modules you installed, and so on. Perhaps there is a way to avoid this consequence, but I haven't spent the time to track it down.

4 comments:

Anonymous said...

Thank you very much! It also solved my problem with ^Z!

- Rune, Norway, http://rhj.info/.

patralekh said...

Hi,

I am using NetBeans 6.0.1. Trying to make a basic GUI. Everything works fine, but then suddenly all the jLabels disappear. Along with the labels the text of jButton also disappears. (jLabels Disappear, buttons do not disappear but the text on the button disappears).

I have observed that this happens when the number of labels (or other components) in the project goes beyond 50 [might be its just a chance and it has nothing to do with this number].

When i see the Inspector Window all my jLabels are there and there is no change in the order or variable names.

I have tried Clean Builds, opening closing netBeans and even restarting the system but nothing worked. And this is the 6th time I am facing this issue for the same project.

When I read your problem and how you resolved it, I was happy thinking it will resolve my issue too but alas... it didnt work. I deleted the folder
"G:\Documents and Settings\Satyam\.netbeans\6.0"
but I am still facing the same issue.

Could you give some insight so that I can resolve this issue. This is the first time I am using somethign other than the vi editor of Unix.

Any help would be greately appreciated.

Thanks & Regards,
patralekh@gmail.com

David Van Couvering said...

Hi, patralekh. It sounds like your problem is just not related to the userdir.

I strongly suggest you subscribe the nbusers alias at http://www.netbeans.org and send your question there. It is an active list and I think you'll get some help. Personally, I am sorry, but I have no idea what is going on for you.

You mention that labels and button text disappear. I wonder if it's a problem with your resource bundle? All text strings are stored there, both label text and button text, as well as other text. Did you look in bundle.properties and see if your text strings are there? Just a thought...

Anonymous said...

Hi, I had exactly the same problem. I found out that the "*.properties" file was not updated after I made changes in the GUI. What eventually helped was restart of Netbeans.