简体   繁体   中英

Exporting and importing java project in Eclipse from Windows to Linux

I'm trying to migrate my java project from my windows machine to my linux machine. I'm using Eclipse's import/export function.

This is how the structure looks like on windows: 窗户结构

but when I import on the linux side the structure is completely different... and it doesn't work.

linux结构

I also tried moving the files/folders directly into the workpath. That kept the structure in place, but when trying to run the files, I only got an "does not contain a main type" error.

Exporting/Importing from windows -> windows works just fine.

Any Ideas why this happens?

I solved the problem now. For some reason the Java version was set to 1.4 in the .project file... don't ask me why. That was the source of the errors in basically every file since this version doesn't support things like the diamond operator and annotations.

To do this I went into Project -> Properties -> Java Compiler -> untick "Enable project specific settings"

Probably one of the more unusual issues I had so far and I have no clue why something like this would be set as default. On a positive note the structure created by the import function was not the issue at all.

The differences you are seeing in the view structure is that you are using a different view on Linux and Windows. On Linux it looks like you are using the standard Java view called Package Explorer that collapses packages and puts nice icons for "source" folders. The Windows screenshot looks like a Navigator View. Unfortunately is it hard to be sure as the screenshot does not show the view name.

Here is a screenshot showing both views side by side on my Linux computer for a simple project:

意见

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM