I am new to java, and I am trying to build a project that has an external dependency. When I try to build it
[javac] Compiling 814 source files to ~/Desktop/Dev/bitcoinj/out
[javac] ~/Desktop/Dev/bitcoinj/src/com/google/bitcoin/core/Block.java:25: package org.slf4j does not exist
[javac] import org.slf4j.Logger;
[javac] ...
How can install the missing external package? Is there a java package manager similar to the python pip
?
There's not a package manager that I know of. You're going to have to manually download the jar file -- in this case, its from http://www.slf4j.org/ . After that, you can either do as Dennis says, or add the jar file explicitly to your classpath.
You could use maven which would do the dependency handling and building for you.
Dependency management is a core feature of Maven. Managing dependencies for a single project is easy. Managing dependencies for multi-module projects and applications that consist of hundreds of modules is possible. Maven helps a great deal in defining, creating, and maintaining reproducible builds with well-defined classpaths and library versions.
To import a package:
-> Download the required jar files (One of the sources for jar files is:https://jar-download.com/)
-> Paste the file @ C:\Program Files\Java\jdk1.8.0_181\jre\lib\ext