Tuesday, April 06, 2010

How to solve NetBeans and Java editors problem when scrolling down large files under Linux the text becomes garbled, distorted or scrambled

I am sure one image tell more than thousands of works, so here... we... go!


If you are experiencing this kind of behavior in your application, IDE or any kind of editor, don't worry so much, it is a misconfiguration of your video device and you can face it in several Java applications. Just to track the problem, some issues was filed against NetBeans Issuezilla and them was identified as a invalid issue, since it is a video card misconfiguration. After some searches and tests I realized how to solve the problem. I am current using a Ubuntu 8.10 with an Mobile Intel X3100 video card, which was automatically configured by Ubuntu in my xorg.conf file as below:

Section "Device"
Identifier "Configured Video Device"
EndSection

The first step to solve the problem is to know which display controller you are exactly using. To got it, I used lspci command line tool, where Display controller property will say what you need. Now, you just need to edit your /etc/X11/xorg.conf file with the code that follow and don't forget to backup your current xorg.conf file:

Section "Device"
Identifier "Intel Corporation Mobile GM965/GL960 Integrated Graphics Controller"
Option "AccelMethod" "xaa"
Option "RenderAccel" "true"
EndSection

where Identifier should be your display controller. Now you just need restart your X server and back to work. For details about this solution, see this discussion and comments are really appreciated.

Another alternative is add a new property for JDK:

-Dsun.java2d.pmoffscreen=false

This should fix it too.

Happy coding!

8 comments:

Varun said...

Hi Michel,

Your blog entry would make a fantastic tutorial for our Community Docs wiki (http://wiki.netbeans.org/CommunityDocs).

Would you be willing to contribute it? If you need any help or have any questions, please contact me at nvarun@netbeans.org

I look forward to hearing from you.

Thanks,
Varun Nischal
NetBeans Community Docs Contribution Coordinator
http://nb-community-docs.blogspot.com/
--
"You must do the things you think you cannot do."

Michel Graciano said...

The wiki page was created in http://wiki.netbeans.org/FaqSolvingEditorGarbledText

Regards

Xtecuan! Ufo said...

Thanks for the tip, the java option works well for Netbeans and JDeveloper too.

Jonathan said...

Hi, thanks for the post, I am running Ubuntu 9.04 and I would like to solve the problem by adding the -Dsun.java2d.pmoffscreen=false as you describe. I am not a Java guy (use netbeans for php) so could you please assist me in how to add this property?

Thanks

Joaquín said...

Thanks very much for your help... i was thinking in don't use netbeans for this problems with text, but now i can use netbeans without problems.

Bammers said...

You are a life saver! THANK YOU.
This pesky issue has been haunting me for way too long - and now its gone.
I used the "-Dsun.java2d.pmoffscreen=false" tomcat property fix as the Xorg stuff wouldn't work for me.


Cheers!

Michel Graciano said...

Good to know that this help you. BTW, if was hard to find this page just let me know some terms you used to search about this problem and can't find anything useful. I wish to make this easier to find since it is a common problem for any Java application in Linux environment.

Jaque said...

Gostei muito do seu blog novo. =D