This might seem like a repetitive question, and on Googling I found a bunch of similar questions asked but seriously, nothing has helped.

I have no idea why the projects don't work as it is when they're imported and how to fix them. I keep getting these errors saying XXX can't be resolved. Screenshots below.

Can anyone please help? I have only JUST started using Ubuntu.

enter image description here enter image description here


Yes you can transfer eclipse programs from ubuntu to windows and the reverse too. For transferring files from windows to ubuntu you need to export you project from Windows and then import the project to Ubuntu.

Exporting File->Export->General->Archival file and tick the project or files(All files related your project must be ticked) which you want to export and select where you want to save the files and you also need to name the file. Now you

Importing File->Import->Archival file and select exported file from Windows. Then there is a field called Into folder: here you need to select your workspace location and click finish

| improve this answer | |
  • I didn't export that. I am not in front of my computer, but I'll try this soon. This looks good. – Programming Noob Jun 1 '12 at 5:45
  • Hey, I tried exporting it to a zip file. When I was importing it back to Eclipse, it said I needed to create a blank project first to import from an archival file. So I created a new dummy java project and them imported it. But now when I compile it doesn't allow me to saying 'Editor doesn't contain main type'. You can see the error and the file hierarchy here :postimage.org/image/w9x171l6b – Programming Noob Jun 1 '12 at 11:29
  • Can I use this with a gitlab server? – tim687 Mar 22 '15 at 12:09

Do not just open the copied project. Use File->Import->Existing project into worksoace.

| improve this answer | |
  • Another option is to use a source control system like subversion and a standard build system like ant or maven. Then you can just check out the project and import it into your workspace. A comment here instead of an answer since it's along the same vein of importing rather than simply opening. – digitaljoel May 31 '12 at 22:39
  • @digitaljoel source control systems are generally nice, but will not help in working with a project copied from another computer (which is what this question is about). Regarding ant or maven - if you have a choice, choose maven. – Thorbjørn Ravn Andersen May 31 '12 at 23:42
  • @ThorbjørnRavnAndersen that is what I did. I copied the folder that contained the project to my Ubuntu desktop and then selected File > Import > Existing project into workspace – Programming Noob Jun 1 '12 at 5:44
  • In that case, open your Build Path and edit the JRE library – Thorbjørn Ravn Andersen Jun 1 '12 at 6:19
  • @ThorbjørnRavnAndersen ignore me for my naivety but as I said I'm new to using Ubuntu. How do I appropriately edit the JRE library? – Programming Noob Jun 1 '12 at 11:30

Maybe the .classpath file in your project directory was not copied as it would be a hidden file under Windows. In Linux anything with it's name starting with . is automatically considered hidden.

Do you get those errors even if you create a new Java project in Eclipse and then copy the src folder to the project?

The .classpath file tells Eclipse from where to load user-classes besides existing classpath(s). So you may get unresolved class problem without it.

| improve this answer | |
  • 1
    No, the symptoms shown indicate that the Java library in the project build path is not correct for this machine. An import fixes this. – Thorbjørn Ravn Andersen May 31 '12 at 23:43
  • If the build path for Eclipse is incorrect then this should occur in every project in Eclipse, not only for the projects imported from Windows, isn't it? – Samik Jun 1 '12 at 6:53
  • The build path for the given project inside Eclipse. The JRE is stored in the .classpath. – Thorbjørn Ravn Andersen Jun 1 '12 at 7:24
  • Ok, you mean the classpathentry kind="con" one. Got it. I thought Eclipse maintain the default classpath centrally i.e. not for each project separately. – Samik Jun 1 '12 at 10:18

The other answers answer you question, but based on your snapshots, I would bet that your project is configured to use a java runtime/SDK at a hard coded locattion. Try and have a look at your project properties, in the Java Build Path/Libraries/JRE System Library, or in Java Code Compiler. If you see windows-like path, it's not good...

Edit: Sorry, more details:

  • Open the project properties, by right-clicking its name (Scratch) in the Package Explorer and clicking on Properties (the last entry of the menu I think)

  • Select Java Build Path on the left, then open the Libraries tab, and develop the JRE System Library item. If you see things like /usr/lib/jvm... you're good. If you see things like c:... that's your problem: the project tells eclipse to look for the java software development kit in a location that is windows-specific.

Hope this help... However, Samik's suggestions seems like a better bet.

| improve this answer | |
  • Sorry, I do not know how to do that. Could you dumb it down? – Programming Noob Jun 1 '12 at 11:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.