Question

I'm trying to port my entire 'workspace' to a USB key (including the Eclipse executable) so that I can carry my work anywhere with me and work off the key directly.

My directory hierarchy is similar to this:

/workspace/eclipse - Where my current eclipse binary is stored
/workspace/codebase - Where I keep the root of all my eclipse projects
/workspace/resources - Where I keep all project files (images, docs, libs, etc.)

It all works perfectly fine on one system. But when I change over to another system, the USB key gets mounted on another drive. For example, on my laptop, I get 'E:\', on my PC, I get 'K:\' and at work I get 'F:\', etc, etc.

This means that because Eclipse (for 'some' reason) seems to only use full path names (including driver letters) in every single one of its configuration files (such as .classpath), nothing ever works when I want to work on another system.

I put a 'libs' directory in the base of every project and populate it with its dependent JAR files. Why doesn't it use relative names instead, so that I could specify something like "../../libs/log4j.jar"?

Anyone know how to fix this problem? Does anyone know of a workaround for this?


Update: 2010.11.09

I've recently discovered Dropbox, which allows you to sync your files online and across your computers automatically with extreme ease. It includes 2GB of free space and you can upgrade to much more if you want (for a yearly fee).

I installed it on my two laptops, my two PC's, my Linux server and my Android phone and then I created a 'workspace' directory within the 'My Dropbox' folder. From the 'workspace' directory, I then installed Eclipse and created/configured all my projects as usual. I can literally work from any computer and everything always stays perfectly in sync. This is way better than any USB key functionality and its hassle!

Was it helpful?

Solution

Have you tried using Eclipse Portable?

The only thing to keep in mind is that when switching the workspace, you need to remember to give it a relative path (like ../../Data/workspace).

OTHER TIPS

You could use the dos command subst to get a consistent drive letter by creating a new virtual drive letter (say x:) that maps to your Eclipse folder on your usb drive, and then make all the config paths reference the drive x:

You could make a little batch file on the usb drive that you click on to create the drive x:

C:\>help subst
Associates a path with a drive letter.

SUBST [drive1: [drive2:]path]
SUBST drive1: /D

  drive1:        Specifies a virtual drive to which you want to assign a path.
  [drive2:]path  Specifies a physical drive and path you want to assign to
                 a virtual drive.
  /D             Deletes a substituted (virtual) drive.

Type SUBST with no parameters to display a list of current virtual drives.

You could also remap letter for your USB stick in Windows Disk Management (subitem in Computer management) to be smth like 'U:'. Once done, it will be re-assigned to same stick every time you plug it. Not very universal, since your user need rights to access this setting first time, but it could help in some different scenarios.

You can always use Ant to build your programs, with Ant you can have relative paths... Plus you can also use Ivy to track dependencies in Ant, I do that in every project that I have.

Another alternative is to manually edit your .classpath files to contain relative paths.

It is a bit of a hassle, though, as you'll have to manually update the files whenever Eclipse changes them.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top