Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Referencing a git repository in my Java File (Eclipse)

Tags:

java

git

eclipse

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

like image 249
AndroidDev Avatar asked Feb 11 '26 07:02

AndroidDev


1 Answers

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.

like image 59
Manish Maheshwari Avatar answered Feb 13 '26 02:02

Manish Maheshwari