Wednesday, March 31, 2010

Eclipse - Linux - Unable to connect to repository

I just moved to new Ubuntu 10.4, and downloading Eclipse or Aptana Studio suddenly stopped working with repositories. This is very very annoying as I'm unable to install pydev and continue working on my improvements of Analytics@bugaco. So, what I had to do something to fix it. It seems that I am not the only one with this problem.

The problem seems to be related to Java's preference to use IPv6 stack over IPv4 stack that causes some systems to be unable to connect to web sites.

Fix for it is documented at debian's bug report's list. The reading is quite verbose, so I'll document cookbook solution that just works for me.

Open your eclipse.ini file, at some stage it has -vmargs line, after that line add following define: 
-Djava.net.preferIPv4Stack=true

Original file
-startup
plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.0.200.v20090520
-product
org.eclipse.epp.package.cpp.product
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
-vmargs
-Dosgi.requiredJavaVersion=1.5
-XX:MaxPermSize=256m
-Xms40m
-Xmx256m



New file
-startup
plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.0.200.v20090520
-product
org.eclipse.epp.package.cpp.product
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
-vmargs
-Djava.net.preferIPv4Stack=true 
-Dosgi.requiredJavaVersion=1.5
-XX:MaxPermSize=256m
-Xms40m
-Xmx256m

Good luck! Let me know if this fixes your problem...