Sunday, January 17, 2010

Fixing Eclipse interaction with kde4.3

I love KDE(no secret!) and kde underwent a big review after Qt4 was introduced. KDE stopped being the environment I loved. So many bugs and it kept crashing all the time. I had to switch to Gnome. I started using Ubuntu(Ubuntu Linux Bible (versions 9.10 and 10.04)) for some time and it was fun for some time. But my longing for KDE just kept me troubling. I was waiting for a stable release and hoping that I get back to KDE. So KDE 4.3 came to my rescue; not only is it stable, its really really fun. 
      Probably I will reserve another post for all the things I love about KDE but for now lets get to the main issue. Lately I wanted to learn Android and start writing applications for the platform. I borrowed "Android Wireless Application Development" from my university's library and so far its just great! 
To develop android applications, I am using google's eclipse plugin. However, lately eclipse stopped working or rather its not working properly on distros with KDE 4.3. You cannot click buttons, only menus work and the eclipse wizards are a pain in the ass! You have to use combination of space bar, tab key and enter key to navigate. Very annoying indeed! Looks like the problem seems to be with the latest SWT framework which has made some kind of internal changes.     
After googling, the fix was very simple. I will describe what you need to do to solve this. It will work for any linux distro you are using. I am going to assume that you have eclipse installed under folder /opt/eclipse. Open your favorite editor(kate/kwrite/jedit whatever) and paste the following contents into the file.
#!/bin/sh
export GDK_NATIVE_WINDOWS=true
cd /opt/eclipse
./eclipse





Save the file under $HOME/bin/eclipse_launch. Next, press Alt+F2. This will bring your runner upfront. Type 'konsole'. After the konsole launches, navigate to your bin directory by typing

cd bin
chmod +x eclipse_launch
Thats it! You can create a shortcut on your desktop for the script or just click the script directly to launch eclipse. The weird problem is gone! Long live KDE :)