4 Feb 2012

Moving Eclipse installation to a different location

I recently changed my username on my laptop from manki to m.  I just had to rename /home/manki directory to /home/m and everything worked just fine, except one program: Eclipse.  For whatever reason, Eclipse writes absolute pathnames like /home/manki/whatever in its configuration files and when /home/manki disappeared, Eclipse could’t figure out what to do about it.

One nice thing about Eclipse is that, like all Unix programs, it keeps all its data in plain text files.  I just had to look for files that contained the string /home/manki and replace those strings with /home/m instead.  The directories I had to scan were:
  • workspace-root/.metadata
  • ~/.eclipse
I used this command to get a list of files that matched:
find ~/.eclipse ~/prog/eclipse-workspace-android \
    -type f \
    -exec grep -l '/home/manki/' {} \;
Once I had the list of files, an easy search-and-replace across all those files did the job.  Eclipse opened with no issues, and it was able to find all the plugins and such.  I think doing the same would be sufficient to move an Eclipse installation from one location to another.

No comments:

Post a Comment