Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Starting application with Erlang

Tags:

erlang

I would like to write a standalone Erlang application which could be run just like any other program (by clicking on .exe executable). Something like Wings3D does.

How can I do it ? What is the best approach to make it possible ? I am on Windows platform, if it is important.

2nd UPDATE:

Well, I haven't exported the promodb:start/0 function and that was the reason Erlang could'n start (and, as the Muzaaya Joshua says, werl -s does not work). But now, I have another strange problem. In my rebar.config I have 2 dependencies:

{deps, [
            {cowboy, ".*", {git, "https://github.com/extend/cowboy.git"}},
            {erlydtl, ".*", {git, "https://github.com/evanmiller/erlydtl.git"}}
        ]
}.

and after I start Erlang using

erl -pa ebin deps/cowboy/ebin deps/erlydtl/ebin deps/proper/ebin -s promodb

I find by application:which_application() that only Cowboy is started:

[{cowboy,"Small, fast, modular HTTP server.","0.4.0"},
 {stdlib,"ERTS  CXC 138 10","1.18"},
 {kernel,"ERTS  CXC 138 10","2.15"}]

As far as I know, Erlang should start all needed applications that I put in my promodb.app file, as:

{application, promodb,
 [
    {description, ""},
    {vsn, "0.1"},
    {registered, [promodb_sup]},
    {applications, [
                  kernel,
                  stdlib,
                  cowboy,
                  erlydtl
                 ]},
    {mod, { promodb, []}},
    {env, []}
 ]}.

What did I do wrong ?

like image 897
Radek Avatar asked Nov 18 '25 06:11

Radek


2 Answers

I use rebar escriptize to pack a standalone package like rebar. Then you can use ./PackageName in linux or escript.exe PackageName in windows.

like image 124
shian Avatar answered Nov 21 '25 10:11

shian


I think you need to create a release package and a boot script as explained in the documentation.

like image 40
jcollado Avatar answered Nov 21 '25 09:11

jcollado



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!