简体   繁体   中英

How one project can reference to another in Eclipse Java

currently, I'm trying to use a pac-man simulator that I found in the github in this link.

The project is consist of two main folder. Pacman-vs-Ghosts and Pacman-vs-Ghosts-Agents. I was able to run the codes inside Pacman-vs-Ghosts folder by using 'import existing project' option in the eclipse.

However, I could not figure out how could I run the second folder Pacman-vs-Ghosts-Agents. On the repository readme, it is written that

PacMan-vs-Ghosts-Agents -> example agents (both Ms PacMan and Ghosts), this project must reference PacMan-vs-Ghosts in order to compile

However, this is my first time with Eclipse so I could not find how to reference to Pacman-vs-Ghosts from the PacMan-vs-Ghosts-Agents project.

If possible could you explain me point by point (couple of picture would be great) how to do that?

You have many means .

1 If you have the source code and know what you want to reuse, just extract some java files, and put them in your project

2 If you have many dependancies, or if you want simply solution, get it or package it as as Jar , and include it in your project

You need to import both projects into the same workspace. Then you right click on the dependent project (PacMan-vs-Ghosts-Agents), Build Path > Configure Build Path, go to the projects tab, click Add and select the dependency (Pacman-vs-Ghosts).

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