Tuesday, February 03, 2009

Configure Aptana for CentOS 5

While moving from a Windows environment to Linux I wanted to use Aptana's free IDE for development, but was having a ton of issues getting Aptana to run correctly on Linux CentOS 5.
So here are my finding:

After I installed Aptana (install directory: /usr/share/aptana )

I keep getting errors like this:

SWT-ERROR

looking in the logs I see this:

!MESSAGE No more handles (java.lang.UnsatisfiedLinkError: /root/.Aptana/Aptana Studio/configuration/org.eclipse.osgi/bundles/72/1/.cp/libswt-mozilla-gtk-3236.so: libxpcom.so: cannot open shared object file: No such file or directory)

!STACK 0

org.eclipse.swt.SWTError: No more handles (java.lang.UnsatisfiedLinkError: /root/.Aptana/Aptana Studio/configuration/org.eclipse.osgi/bundles/72/1/.cp/libswt-mozilla-gtk-3236.so: libxpcom.so: cannot open shared object file: No such file or directory)


Well after search the forums and other sites for about an hour, people suggested I install these packages.
  • yum install gtk2-devel
  • yum install xulrunner
  • yum install libstdc*
  • yum install gtk2*
  • yum install libswt3-gtk2*
  • yum install compat-libstdc++-33
I had some already installed and I don't know if they are really required but there they are for you.

After all that it still didn't work until I came across this post. in the post it has a file you need to download called aptana.sh.

Here is the code if the file is not available:

/*************** START OF FILE **************/

#!/bin/bash

# Set path for the Mozilla SWT binding

MOZILLA_FIVE_HOME=${MOZILLA_FIVE_HOME%*/}
if false && [ -n "$MOZILLA_FIVE_HOME" -a -e $MOZILLA_FIVE_HOME/libgtkembedmoz.so ]; then
:
elif [ -e /usr/lib/mozilla/libgtkembedmoz.so ]; then
export MOZILLA_FIVE_HOME=/usr/lib/mozilla
elif [ -e /usr/lib/firefox/libgtkembedmoz.so ]; then
export MOZILLA_FIVE_HOME=/usr/lib/firefox
elif [ -e /usr/lib/xulrunner/libgtkembedmoz.so ]; then
export MOZILLA_FIVE_HOME=/usr/lib/xulrunner
elif [ -e /usr/lib/mozilla-firefox/libgtkembedmoz.so ]; then
export MOZILLA_FIVE_HOME=/usr/lib/mozilla-firefox
elif [ -e /usr/lib/mozilla/libgtkembedmoz.so ]; then
export MOZILLA_FIVE_HOME=/usr/lib/mozilla
else
$DIALOGW \
--title="Integrated browser support not working" \
--text="This Eclipse build doesn't have support for the integrated browser."
[ $? -eq 0 ] || exit 1
fi
# libraries from the mozilla choosen take precedence
LD_LIBRARY_PATH=$MOZILLA_FIVE_HOME${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}

# Do the actual launch of Aptana Studio
exec ./AptanaStudio


/*************** END OF FILE **************/

Still didn't work so I decided to see if the file it was trying to call existed. the command for the file name in:

locate libgtkembedmoz.so

it found it so I added the condition to the script and now it works great, YEAH!!

elif [ -e /usr/lib/esc-1.0.0/xulrunner/libgtkembedmoz.so ]; then
export MOZILLA_FIVE_HOME=/usr/lib/esc-1.0.0/xulrunner

Let me know of any other findings that might help out.

Thanks,
--Phill

1 comment:

Kane said...

Hi. I've got problem, i can't run some program on CentOS5. I think it's problem with mozilla. Could You look at the file?

#!/bin/sh
ED_FOLDER=$HOME/ed
echo ---------------------------------------------------------------------
echo UWAGA: Elraty Desktop powinien byc w katalogu: $ED_FOLDER
echo ED jest teraz uruchomiony z: `pwd`
echo ---------------------------------------------------------------------
cd $ED_FOLDER
MOZILLA_FIVE_HOME=$ED_FOLDER/mozilla/lib/
LD_LIBRARY_PATH=$MOZILLA_FIVE_HOME:./
export MOZILLA_FIVE_HOME LD_LIBRARY_PATH
java -Djava.library.path=${LD_LIBRARY_PATH} -jar elraty-desktop.jar

I'll be grateful