r/javahelp • • Nov 05 '18

Handling libraries in Java (confused python programmer)

I usually code in python where downloading libraries is conveniently handled using pip or anaconda. Installing libraries is not more complicated than running a single command in the terminal.

However just starting out with libraries in Java I find myself bewildered on how to download libraries in a convenient way... So far I've tried just downloading JAR-files from my browser manually but that isn't very efficient. I've tried looking into Maven but found it a bit confusing and I'm not even sure that's where I should be looking?

Any help is appreciated!

17 Upvotes

15 comments sorted by

View all comments

5

u/Ialda Nov 05 '18 edited Nov 05 '18

Keep looking into Maven. Historically it's the main build tool of the Java ecosystem, and managing your project's dependancies is part of its tasks.

In Eclipse, you can either start a new project as a maven project, or convert an existing one (configure -> convert to maven and create a pom.xml file). As Eclipse has its own building process, don't forget to Maven -> update your project every time you modify your pom.

You can also use maven on the command line (typically mvn clean install) if you have downloaded the binaries and added maven bin rep to your path. You may also have to set a M2_HOME env variable pointing to the install rep. EDIT : my bad, M2_HOME appears to be deprecated.