Developing a Java Eclipse project on both 32bit and 64bit Linux systems

I have a series of related projects that I've placed under Git control (all these projects are in the same workspace, which is the top-level of the Git repository) and cloned from my desktop (32bit) to my laptop (64bit) so I can work on them wherever. The workspace .metadata folder is excluded, but everything in the project folders is tracked.

When I opened the cloned workspace on the laptop, I was greeted by an error:

Project 'project' is missing required library:
'/usr/eclipse/plugins/org.eclipse.swt.gtk.linux.x86_3.5.2.v3557f.jar'

Obviously, the 64bit eclipse doesn't have the 32bit libraries, but I'm curious as to how this should be resolved.

That library was added as part of the Window Builder SWT/JFace Project template. There is a org.eclipse.swt_3.5.2.v3557f.jar in the eclipse plugins folder, but changing the classpath to look for that doesn't work (doesn't find SWT, oddly). Looking through the rest of the .classpath file for the SWT/JFace projects, this particular library is the only one that is so platform specific.

I put both versions of the library in the .classpath and this allows the code to build/run, though I have to ignore the build path error, and this error will propagate back to my desktop when I pull the laptop changes back.

Can I just symlink the 64bit jar on the laptop to the 32bit name so the classpath can find the library? Is there another, better solution?

UPDATE: It looks like this type of project has to depend on the concrete SWT fragment, so until there's a better solution I'm going to symlink the fragments in question on both machines to direct the compiler to the correct fragment. Building/running the projects on other machines (and especially Windows) will be !!Fun!! but I'll build that bridge when I get there.

Answers


What exactly are you keeping in your source control?

The best practice is to keep only hand-written source files on source repository. Not binaries, or generated files, or IDE settings.

I think you have the problem with the IDE settings for your 64bit Eclipse not working with 32bit one.

Just delete .metadata directory in your workspace, and reimport all projects in this Eclipse.


Don't do it with the whole workspace. Just do it with the individual projects. Works well here.


Which type of the project you are developing? The java project or plug-in project?

If you're developing plug-in project, your project should not directly depend on the concrete swt fragment(such as swt.gtk, swt.win32). It should depend on the host plug-in 'org.eclipse.swt' that the actual implementation of swt is the different fragments in different platforms.

If you're developing a java project that requires the swt as the third-party requirement. You can install eclipse delta package for both your 32bit and 64bit eclipse.


Need Your Help

How to parse these time zones with NSDateFormatter?

iphone ios osx nsdate nsdateformatter

I'm parsing a large number of internet dates. First I try a formatter with en_US_POSIX locale, then with en_GB. The code looks more or less like this: