Givi Arabidze
Givi Arabidze

Reputation: 35

erlang R16B01 and Windows CMD

I'm windows 7 user and try to learn erlang and here's the time when I get to the paragraph where I have to deal with creating and naming nodes. I used to start erlang emulator from shortcut and don't know how to start it from command prompt window to use -name or -sname commands, and when I try to use

net_kernel:start([node,shortnames]).

command I get

{error,
    {{shutdown,
        {failed_to_start_child,net_kernel,{'EXIT',nodistribution}}},
        {child,undefined,net_sup_dynamic,
        {erl_distribution,start_link,[[node,shortnames]]},
        permanent,1000,supervisor,
        [erl_distribution]}}}

=INFO REPORT==== 23-Aug-2013::15:28:03 ===
Protocol: "inet_tcp": register/listen error: econnrefused

error. I thought it was because of windows firewall and turned it off, but nothing has changed. So can someone answer what's going on?? And if you don't mind teach me how can I start erlang from CMD and use -name and -sname commands.

Upvotes: 1

Views: 463

Answers (2)

Pascal
Pascal

Reputation: 14042

I am, most of the time, a windows user, and as it is not natural in this environment to use command windows, I used to write some command files to invoke werl (the usual VM interface in windows). But I stopped that, because it is less convenient and less flexible than the command window, and also because I very often need other command line tools like ping, ipconfig, or git...

I join an example of the code you can use:

launch_werl.bat:

echo off
echo Select a project:
echo     1: project 1
echo     2: project 2
echo     3: project 3
set /p proj=
goto label%proj%


:label1
d:
cd "\git\project1"
set prname=proj1
goto end


:label2
d:
cd "\documents and Settings\user\My Documents\path\to\some\code"
set prname=proj2
goto end


:label3
d:
cd "\git\proj3"
set prname=PLC
goto end

:end
start werl -sname %prname% -pa "./ebin"
echo on

Upvotes: 0

user2624443
user2624443

Reputation: 60

1) make sure you have in the path, program files \ erlang \ bin \ erl
2) open the command prompt and type
3) erl -sname dilbert

-name = for fully qualified name [dilbert@mypc.maydomain.com]
-sname for short name [dilbert@mypc]

this will give you

% erl -sname dilbert
  (dilbert@mypc)1> node().
   dilbert@mypc

Upvotes: 1

Related Questions