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
?
Java has an import statement that allows you to import an entire package (as in earlier examples), or use only certain classes and interfaces defined in the package. The import statement is optional in Java.
Java has two main options for package management, Maven is the industry standard. Maven Central Repository is an online repository containing a vast array of packages available for use in your projects.
class files, they're in lib\rt. jar in the JRE directory ( . jar is the same as . zip , so you can open it with anything that can open zip files).
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With