Running Erlang

This page is organized as follows:

  1. Running Erlang on Your Own Machine
  2. Troubleshooting
  3. Advanced Topics

You should use the Erlang OTP system for this class.

Return to top

Running Erlang on Your Own Machine

The Erlang system is most convenient to use on your own computer.

Getting Erlang for your Own Machine

The Erlang system used for this course is available on many platforms, including Linux, Macintosh, and Windows. You can download it from erlang.org. You may also want to use the precompiled binaries at https://www.erlang-solutions.com/downloads/download-erlang-otp for operating systems other than Windows. For OSX, you can also install Erlang from the command line with brew install erlang (if you use Homebrew) or port install erlang (if you use MacPorts).

To use erl at the command line, you should put the full path to Erlang's bin directory in your PATH environment variable. (To set environment variables in Windows XP/Vista/7, start the control panel, then click on "System", then the "Advanced" tab, then click on "Environment Variables".)

If you find more details about a system that you had trouble with, see the course staff. If you fix such a problem yourself, please let us know how you fixed the problem.

Return to top

Troubleshooting

Case Problems

Erlang is case sensitive. Be sure to use names that start with an upper case letter (A-Z or _) for variable names and formal parameters. For example, if you write a function like:

square(n) 
             -> n*n.
      
Then this code does not work when called. Do you see why?

Other Problems

If you are having a problem not described above, or if the solutions listed above are not working for you, you can look at the webcourses2 discussions, where we often post answers to other people's questions. If none of that help then please don't hesitate to contact the course staff.

Return to top

Advanced Topics

There are a variety of programming environments for Erlang that are described below.

Erlang Eclipse Plugin

There is an Erlang plugin for Eclipse. See http://erlide.org/installation/ for installation instructions.

Running Erlang from Within Emacs

To run Erlang from within Emacs, see http://erlang.org/doc/man/erlang.el.html under the heading "Shell". This is what Gary uses in class.

Windows Keystrokes in Emacs

If you like to use the standard Windows keystrokes for cut, paste, and copy, customize Emacs to use CUA-mode by default. (This assumes that you have Emacs version 22 or later. Use the menu "Options", select "Customize Emacs", and from there the select "Top Level Customizations". then select the "Convenience" group by clicking on the "go to group" link, and then go to the Cua group, and click on the "Value Menu" for enabling this customization.

If the above doesn't work, or if you have a version of Emacs previous to 22, put the following in your emacs initialization file, ~/.emacs.el. (The lines that start with a semicolon are comments, and can be omitted.)

(if (< emacs-major-version 22)
  (progn
    ;; Make emacs more like standard windows applications in terms of
    ;; mouse selections (this is similar to pc-select).
    ;; One advantage is this is that it makes Dragon Dictate work with Emacs.
    (require 'cua)
    ;; Make the behavior of emacs on C-c, C-v, C-x, and C-z to be
    ;; just like that of be as in standard window apps, so you can use
    ;; these keys to copy, paste, and select when there is a selection
    ;; active, then uncomment the following.
    (CUA-mode t)
    ;; Make C-c leave the region active, which is what happens under Windows.
    (setq CUA-mode-keep-region-after-copy t)
  )
  ;; The same for emacs version 22 (and hopefully higher...)
  ;; but not for aquamacs, which already has it.
  (if (not (featurep 'aquamacs))
      (progn (cua-mode)
             (setq cua-enable-cua-keys t)
             (setq cua-mode-keep-region-after-copy t)
      )
  )
)

Alternatively, you can use Gary Leavens's .emacs.el file which includes the above lines and several other things. It should be saved into .emacs.el in your home directory. (On Windows you may not have a home directory yet, so pick one. You also have to set HOME in the environment; this is automatic in Unix and hence on Mac OS X, but needs to be done by hand in Windows.)

For Vi Users

If you are a vi user, you may want to use viper-mode in emacs to get the vi keystrokes and still use all the wonderful Emacs features. To do this, put the following in your .emacs.el file:

(viper-mode)

Return to top

Last modified Tuesday, November 12, 2013.

This web page is for the Fall 2013 offering of COP 4020 at the University of Central Florida. The details of this course are subject to change as experience dictates. You will be informed of any changes. Please direct any comments or questions to Gary T. Leavens at leavens@eecs.ucf.edu. Some of the policies and web pages for this course are quoted or adapted from other courses I have taught, in partciular, Com S 342.