Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Equivalent of Java JAR files in Erlang

Tags:

java

jar

erlang

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.

like image 610
Ranjit Iyer Avatar asked Jun 27 '14 02:06

Ranjit Iyer


People also ask

Is jar and ZIP same?

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.

Is JAR file same as library?

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.

Is Java jar a binary?

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.

What Java JAR file contains?

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.


1 Answers

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.

like image 197
Nathaniel Waisbrot Avatar answered Sep 22 '22 15:09

Nathaniel Waisbrot