+ 1

Importing 3rd party libraries into java?

Hey, just wondering, if I want to use a library outside of the core java libraries, how do I import them? I downloaded Googles Guava libraries from github and I see the whole com.google.common.net; package that i want to use within the file structure of the zip folder I downloaded, but then it cant resolve all of the dependencies and whatnot when I try using it in eclipse. I’m sure i just have to place the package somewhere within my projects file sructure, or point my IDE to the package, but I’m unsure how. I know there must be a method to doing this but I’ve never learned how and haven’t found anything online to help out. I figured a community of coders would be able to help.

21st Nov 2018, 2:30 PM
PacketStorm
PacketStorm - avatar
2 Respuestas
+ 4
I'd recommend to use a build management tool like Apache Maven which can manage the dependencies. But if you don't want to use a tool add the file to the classpath. IDEs have forms in the preferences to achieve that easily, but maybe you want to do it manually for a better understanding what's going on: https://docs.oracle.com/javase/7/docs/technotes/tools/windows/classpath.html
21st Nov 2018, 6:07 PM
Tashi N
Tashi N - avatar
+ 1
Awesome thanks so much, yes I would prefer to do it manually to understand whats going on because I like programming without an IDE sometimes too in linux and compile using javac from a terminal. This looks like exactly what I needed thank you again!
23rd Nov 2018, 2:35 PM
PacketStorm
PacketStorm - avatar