Anonymous Entity
Anonymous Entity

Reputation: 3350

USB based eclipse project

I have two computers, and want to share a java project in eclipse by saving and opening the project from my USB stick.

But I can't seem to get it to work very easily.

What steps do I need to take to set this up properly?

Upvotes: 1

Views: 1229

Answers (3)

E-Riz
E-Riz

Reputation: 32895

I strongly recommend using a cvs, svn, or other version control repository for this purpose. Trying to manage it manually is eventually going to bite you.

But if you insist, the best way I know of is to create the project in Eclipse by un-selecting the Use Default Location option in the New Java Project wizard. That allows you to specify an external location for the project contents, in your case the USB drive. You'll have to make sure of a few things:

  • that the USB drive is always plugged in while Eclipse is running.
  • Refresh the entire Project each time you move the USB drive from one computer to the other.
  • Any references to JARs are either internal to the project (eg, in a /lib folder inside the project) or use Classpath Variables.

It's going to be quite tedious, which is why it's always recommended to not try this and use a version control repository instead.

Upvotes: 1

Bernd Ebertz
Bernd Ebertz

Reputation: 1327

I do this. With some projects I have in SVN or GIT. For me it's more important to have only one eclipse and one workspace. Unfortunately this limits to Windows (or one os). The trick is to ensure that it always has the same drive letter. I tried with subst first, but I forgot to often. But using the drive manager from Windows everything works fine.

Upvotes: -1

Raffaele
Raffaele

Reputation: 20875

These things should be discouraged. My advice is using an SCM (Source Control Management) like Git and keep a repository on the external drive (if using Git, a bare repository on the USB stick and a local repository on each machine). At the beginning you'll spend quite some time getting used to, but it will pay soon (you'll have descriptive changelogs and disaster recovery facilities)

Eclipse has support for Git via Egit, and for SVN builtin.

When you share a project like this, you may encounter troubles related to classpath references to external JARs, which may be overcome by

  1. using a lib/ folder (thus keeping the JARs under version control)
  2. using an environment variable like $JAVA_LIB
  3. using some dependency manager like Maven or Ivy (again, there are lots of stuff, but will pay even in the short term)

For existing project that you don't want to put under version control, you can simply (again, there may be missing library errors) use the menu File > Import > General > Existing projects into workspace

Upvotes: 2

Related Questions