Wednesday, November 7, 2007

Getting GWT working on Ubuntu AMD64

Get this error?
/gwt-linux/libswt-pi-gtk-3235.so: wrong ELF class: ELFCLASS32 (Possible cause: architecture word width mismatch)

Error comes from running 64bit java and trying to use 32bit java compiled libraries.

I finally found the easiest work around for getting ./KitchenSink-shell to work on my desktop. I have ubuntu amd64 installed. I traded gij for sun-java-6-bin java. Then installed ia32-sun-java6-bin which added 32bit java on the hard drive for use. (in my case located /usr/lib/jvm/ia32-java-6-sun-1.6.0.03/bin/java, check synaptic properties for installed files)

This is the java I used to run the ./KitckenSink-shell. I replaced "java" with "/usr/lib/jvm/ia32-java-6-sun-1.6.0.03/bin/java"

Now to find a way to change the environmental java variable.

1. Optional: Install sun-java-6-bin and remove gij... (this will replace the with suns java)
2. Install ia32-sun-java6-bin
3. Install galternatives (this is the progam to have for defaults!!!)
4. Run galternatives from shell (don't sudo this, b/c it will change roots defaults and not yours.)
5. Find java in galternatives, choose the default jvm (Find em located in /usr/lib/jvm)
Install as many JVMs as you want to, and choose the one you want to use with galternatives.

#This is a must have!!
sudo apt-get galternatives

#Another way to do it in shell
#sudo update-alternatives --config java


If you have the same problem in Eclipse. Configure the JRE. Goto Installed JREs..., Hit Add, and find another jvm in /usr/lib/jvm.
or
In Run > Java Application > Your Application Configuration > JRE > Installed JREs... > (Preferences) Add > /usr/lib/jvm/ia32...jvm



Great Reference Article:
http://antbook.org/display/antbook/Installing+Java+6+on+Ubuntu+7.04

5 comments:

Unknown said...

thank you for tip, especially for introducing galternatives. It helped me.

Peter Sankauskas said...

Another solution is to install the 64-bit version of the JDK on top of a 32-bit installation. More details are here:
http://blog.pas.net.au/2009/05/26/gwt-on-ubuntu-amd64/

Logi said...

Thank you very much, saved me alot of time trying to figure out what was wrong with my setup =)

Unknown said...

Actually you don't need the update-alternatives thing. You can just update the default JRE in eclipse's "java" preferences.

You need to add the 32-bit JRE and set it as default. Then, if you like, restart eclipse.

romanofski said...

Cheers for that. Especially with the alternatives. You find heaps of tutorials explaining on how to do it with Eclipse, but not without it.

Trying out the Dart Analysis Server

I wanted to see how the Dart Analysis Server was put together and worked. I started looking to see how I could wire it up and try out the co...