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

4
  • you need to actually clone the repo in your workspace to use it. Commented Oct 23, 2014 at 18:02
  • Thanks. Unfortunately, I don't know how to do that. I'm pretty new to git. Commented Oct 23, 2014 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) Commented Oct 23, 2014 at 18:19
  • Here is great answer for your question. stackoverflow.com/questions/6760115/… Commented Oct 23, 2014 at 18:29

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you. I've spent hours on this, and it was that simple. I appreciate your help!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.