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.
In the marker tab at the bottom, there are (1) java build path problems and (2) facet project problems.
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.
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.
Does this mean that the project settings are inherited from the previous PC, but different from those in the workspace?
With the JRE System Library selected, click Edit to display the screen below. ↑ Click the installed JRE
↑ Click search
↑ If you select the folder where JRE is installed, it will be searched and added automatically.
↑ 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.
↑ When you return to the screen, you can select the added JRE in the alternative column, so set it to 11.
↑ 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)
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".
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: ↑ 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).
↓ 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)
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
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