[JAVA] [Using Eclipse] Precautions when moving the workspace being created to another PC

Memorandum and sharing

When I was a programming beginner, I was making a web application in Java using Eclipse. Workspace → I created a project and wrote various code, but I had to work on a different PC, so when I tried to copy the entire workspace and move it to another terminal to work The trouble that happened.

I got the following error


In the marker tab at the bottom, there are (1) java build path problems and (2) facet project problems.

Assumptions / Discussion

In Eclipse, workspace settings are saved in a .metadata file for each workspace. When I copied the entire workspace and moved the data to a different environment, I think that the above error occurred, probably because the settings could not be passed properly between the destination Eclipse and the configuration file. .. The perspective and theme settings that were set on the PC that I first worked on have also been initialized. The project is not loaded and the server is not created.

I imported the project from the import menu with "Import existing project into workspace", Perhaps the workspace settings and the project-specific settings didn't link well.

Take a look at the project properties

In this state, right-click the imported project> Properties and open the Java build path. << JRE System Library >> is unbound. Also, "Server Classpath Container" is also unbound.

2.jpg Does this mean that the project settings are inherited from the previous PC, but different from those in the workspace?

Resolve from JRE system library

With the JRE System Library selected, click Edit to display the screen below. 3.jpg ↑ Click the installed JRE

4.jpg ↑ Click search

5.jpg ↑ If you select the folder where JRE is installed, it will be searched and added automatically.

6.jpg ↑ What you searched for was added to the installed JRE. Since it was java11 on the PC before migration, select 11 and set it as the default.

7.jpg ↑ When you return to the screen, you can select the added JRE in the alternative column, so set it to 11.

8.jpg ↑ Then, the x that was displayed first disappeared. For some reason, when you apply it, close it, and open it again, it is marked with a cross, so when you select the specified version from the installed JRE again, the x and unbound display disappear and you move to the module path. did. (Image below)


Then resolve the server classpath container

This time, the server was not created when the workspace was opened, so create the server. At the bottom, click "No server available. Click this link to create a new server". 12.jpg

This time it was Tomcat9, so select it (left window in the next image). Also, you should be careful about the settings of the server runtime environment under the server name. Click "Configure Runtime Environment" at the bottom right of the server runtime environment, and the right window of the image will appear. Select the location of the name of Apache Tomcat. Then, the edit button on the right side can be selected, so click it.


This will display the currently selected server runtime environment as follows: 14.jpg ↑ You have to check the installation directory of Tomcat and link it with the setting of the JRE system library that you solved earlier. Here, Java 11 has already been set as the default JRE, so there is no problem with the workbench default JRE in the JRE column.

If a different JRE is selected, fix it or click "Add ..." from the first new server definition window to set it.


Right-click the project> Reopen the Java build path and look at the Library tab. The server classpath container is unbound, but with this selected, click the edit button on the right.

Then, the window on the right side of the image below will appear, so select the runtime you set earlier (if you have created other settings, that will also be displayed). 15.jpg

↓ Finally, when you return to the project properties and click the target runtime item, the runtime list will be displayed, so make sure that the runtime you set earlier is also checked. (In my case, there was a check in a different place) 16.jpg

Now, when I apply and close it, all the errors are gone. (If you have set individual settings for character code or warning / error, you have to set them separately.)


Perhaps this is the most important. You may have to use export / import to move folders to different environments for different workspaces. I said "per workspace", but to be precise, it is "workspace (setting)".


◆ File> Export In the Export Wizard that opens, General> Settings → Next

With "Export All" checked, specify the folder name and file name of the export destination from the destination setting file and click Finish to create an .epf file in the specified location. (This file does not contain the project)


When importing First of all, when you start Eclipse, you will open some kind of workspace, but the image is that you load the workspace settings (.epf) that you exported earlier. The project itself is imported and used in the completed workspace. When importing, I think that there was also a setting to copy the imported project to the workspace, so you need to select it if necessary.

◆ File> Import In the Import Wizard that opens, General> Settings → Next

Complete with all imports checked

Last but not least

Thank you for calling me for a long time. Since I have a short history of programming and using Eclipse, I still have a little understanding, but I would like to solve each problem one by one even if it takes time.

Recommended Posts

[Using Eclipse] Precautions when moving the workspace being created to another PC
When the server fails to start in Eclipse
When the hover of Eclipse is hard to see
Command to try using Docker for the time being
Failed to create the Java Virtual Machine when installing Eclipse.
When using FloatingPanel, the tableView created by Stroybard becomes nil
I tried to translate the error message when executing Eclipse (Java)
Easy way to create a mapping class when using the API
How to solve the unknown error when using slf4j in Java
I tried to display the calendar on the Eclipse console using Java.
The story that the build error did not stop when using Eclipse 2020
[Rails 5] How to display the password change screen when using devise