This is a completely newbie question from a Java programmer trying to learn Erlang. What's the equivalent of a Java JAR file in Erlang by which 3'rd party libraries can be included in an Erlang application?
The other day I made a copy of the mochijson2.erl in my project and it worked, but I am wondering if there's a better/more formal way of discovering and including libraries in the Erlang world.
JAR file is a file format based on the popular ZIP file format and is used for aggregating many files into one. A JAR file is essentially a zip file that contains an optional META-INF directory. A JAR file can be created by the command-line jar tool, or by using the java. util.
A JAR serves the same function an an Assembly in the C#/. net world. It's a collection of java classes, a manifest, and optionally other resources, such as properties files. A library is a more abstract concept, in java, a library is usually packaged as a JAR (Java ARchive), or a collection of JARs.
Jar file contains compiled Java binary classes in the form of *. class which can be converted to readable . java class by decompiling it using some open source decompiler.
A Java Archive, or JAR file, contains all of the various components that make up a self-contained, executable Java application, deployable Java applet or, most commonly, a Java library to which any Java Runtime Environment can link. There are two key benefits of using a JAR file.
If you're familiar with Maven (or its siblings), the Erlang analogue is Rebar.
You could create a rebar.config
(similar to a POM file) with the contents
{deps, [
{mochiweb, "2.9.0", {git, "https://github.com/mochi/mochiweb.git", {tag, "v2.9.0"}}}
]}.
Then rebar get-deps && rebar compile
will fetch mochiweb (and any dependencies it declares), build the dependencies, and build your own code.
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