0

I am trying to use the repository MySQL. The first instruction in the tutorial tells me to put the repo into my project in my workplace. Then, it tells me I can access it immediately using MySQL as a type, like other objects and what not. However, it seems that I cannot access the repo what-so-ever.

What is the correct way to go about importing a repository into my current project?

staticCoffee
  • 127
  • 11
  • Possible duplicate of [Importing a GitHub project into Eclipse](http://stackoverflow.com/questions/6760115/importing-a-github-project-into-eclipse) – shmosel Jan 12 '17 at 04:10
  • It is not the same question. That just explains how to import a repo into an Eclipse environment. I'm talking about importing the repo and then being able to use it in my current project. – staticCoffee Jan 12 '17 at 04:12
  • 1
    Try Project > Properties > Java Build Path > Projects > Add... > Select the repo project – shmosel Jan 12 '17 at 04:13
  • 1
    @shmosel from the language the OP used I understand that he's not refering to git. Rather simply import by hard copy. – Mordechai Jan 12 '17 at 04:13
  • Btw if all you want is just to connect to your MySQL server you should rather use Connector/J (included in installation). Otherwise cloning should be used if you want to contribute IMHO. – Mordechai Jan 12 '17 at 06:03

1 Answers1

1

You have to add it to the classpath, so the JVM knows to look for it.

Right click on the file and select "Add to Build".

Mordechai
  • 15,437
  • 2
  • 41
  • 82
  • Right click on the "file". Is this the cloned repository directory? My apologies, but I'm fairly unfamiliar with the Java and the Eclipse environment, being a Javascript and Python developer myself, so if you could hold my hand a bit and add some more detail to the post, that'd be awesome. – staticCoffee Jan 12 '17 at 04:58
  • Not in front of my PC, usually deal with jars this way. Almost certain the same is with the cloned directory. – Mordechai Jan 12 '17 at 05:46
  • Oh just thought about it. You should set the source directory as the build path. Otherwise the compiler will complain about wrong package names (as all parent directories until src are mistaken for part of the packaging). – Mordechai Jan 12 '17 at 05:59
  • I think eclipse should have an option "set as source folder". You should use this option instead. Lemme know if it helps, i'll update answer to reflect that. – Mordechai Jan 12 '17 at 06:00
  • One more thing to note, you can make that a completely separate project and set you project as dependent on the other. Look for the option "configure build path" for doing this. – Mordechai Jan 12 '17 at 06:14