11

I recently installed Erlang RFC4627 (JSON-RPC) with the debian package. I ran the test server using:

sudo erl -pa ebin

and then at the prompt:

test_jsonrpc:start_httpd().

returned

ok

I tested with http://:5671/ and got the success messages.

When I try to run rabbitmq-http2 however, I get the errors that the readme says are caused by rfc4627's code not being on the erlang search path. How do I put it on the path. I saw something on Dave Thomas's blog which suggested putting the path in the file:

~/.erlang

This didn't seem to work for me (maybe I did it wrong?).

David
  • 2,715
  • 2
  • 22
  • 31
  • Gordon, I appreciate your answer below (voted it up). Unfortunately I have tried several methods including the .erlang file and applying the path to the -pa in the make file. I guess my question is a little more particular to rfc4627 and rabbitmq-http2. – David Aug 09 '09 at 16:46
  • Add more information about paths to the directories with the beams, and how you add the paths to the code server. Especially, where do you have the beams for the rfc4627 library? – Christian Aug 13 '09 at 11:49
  • Christian, actually, I got this all working, I've been meaning to respond to this explaining some of what I did. I'll probably do that later this week. – David Aug 18 '09 at 01:20

1 Answers1

20

The code module is how you manipulate the path within an application.

The flags -pa that you used in starting the Erlang shell actually refer to a function in this module:

add_patha(Dir) -> true | {error, What}

You are right about the .erlang file in your home directory - it is run at start-up time of the shell and you can add in handy paths.

For an application you can start the shell with a batch file that calls something like this:

erl -pa ./ebin ../../lib/some/path/ebin

The flags behaviour of erl is described here.

For more sophisticated path management you need to get familiar with how OTP release management is done (but I suspect that is a while away for you yet).

Gordon Guthrie
  • 6,252
  • 2
  • 27
  • 52
  • as stated above, I didn't need to do this, but It's a good answer! – David Nov 10 '10 at 18:41
  • What is the format of the .erlang file? Or even better, where can I find documentation about it – Masse Aug 25 '11 at 05:52
  • It takes erlang terms which are evaluated as if entered in the shell. See here Section 1.7.1 http://www.erlang.org/documentation/doc-5.2/doc/getting_started/getting_started.html – Gordon Guthrie Dec 20 '11 at 14:05