简体   繁体   中英

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

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> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM