user14490044
user14490044

Reputation:

How to run a beam file generated by erlang

I am a beginner in erlang. Please help me run an erlang program.

In the command line, I used this - c(main). to create a beam file. Now how do I run the program. I am on windows.

% this is the hello world program I am trying to run
-module(main).
-export([start/0]).

start() ->
   io:fwrite("Hello, world!\n").

Any help is highly appreciated.

Thank you

Upvotes: 1

Views: 2175

Answers (1)

Nalin Ranjan
Nalin Ranjan

Reputation: 1782

What you have written is a module. If compiled, then you will have to call the functions of this module to evaluate. Do like below, in the same command prompt where your Erlang Emulator(erl) is running...

Eshell V11.1.7  (abort with ^G)
1> main:start().
Hello, world!
ok
2> 

Upvotes: 3

Related Questions