3

I'm creating a new Java project in Eclipse.

I want to be able to access code that I pulled from a Git repository.

I do not want to change the git code at all - I just need to import it into my code so that I can call its methods.

The git repository is all set up in Eclipse.

I can't figure out how to get my code to see it. I've tried importing JAR files, libraries, etc., but am not successful. Every tutorial I find just shows how to publish my own file to git, but not how to use a third-party repository.

If someone can refer me to an existing resource or question, that's fine too. Thanks!

enter image description here

Rann Lifshitz
  • 4,040
  • 4
  • 22
  • 42
AndroidDev
  • 20,466
  • 42
  • 148
  • 239
  • you need to actually clone the repo in your workspace to use it. – njzk2 Oct 23 '14 at 18:02
  • Thanks. Unfortunately, I don't know how to do that. I'm pretty new to git. – AndroidDev Oct 23 '14 at 18:15
  • from your screenshot, the library you are trying to use is in your home dir? you probably just need to import it in eclipse, then (and refer it as another project in the buildpath) – njzk2 Oct 23 '14 at 18:19
  • Here is great answer for your question. http://stackoverflow.com/questions/6760115/importing-a-github-project-into-eclipse – njjnex Oct 23 '14 at 18:29

1 Answers1

2

Add the git repo to the Java Build Path in Eclipse.

Project->Properties->Java Build Path->Libraries->Add Class Folder -> Add the git repo folder, starting from the parent of "com/flickr" folder here.

Alternatively, Project->Properties->Java Build Path->Libraries->Add External Class Folder -> Add the git repo folder, starting from the parent of "com/flickr" folder here.

Clean and compile your project after adding the git repo to Java Build Path.

Manish Maheshwari
  • 4,045
  • 2
  • 15
  • 25